gitlab.com/evatix-go/core@v1.3.55/coreimpl/enumimpl/OnlySupportedErr.go (about)

     1  package enumimpl
     2  
     3  import (
     4  	"gitlab.com/evatix-go/core/errcore"
     5  	"gitlab.com/evatix-go/core/internal/csvinternal"
     6  )
     7  
     8  func OnlySupportedErr(
     9  	allNames []string,
    10  	supportedNames ...string,
    11  ) error {
    12  	if len(allNames) == 0 {
    13  		return nil
    14  	}
    15  
    16  	unsupportedNames := UnsupportedNames(
    17  		allNames,
    18  		supportedNames...)
    19  
    20  	if len(unsupportedNames) == 0 {
    21  		return nil
    22  	}
    23  
    24  	supportedCsv := csvinternal.StringsToStringDefault(
    25  		supportedNames...)
    26  
    27  	unsupportedCsv := csvinternal.StringsToStringDefault(
    28  		unsupportedNames...)
    29  
    30  	supportedMsg := "Only supported (" + supportedCsv + ")"
    31  	unsupportedMsg := "Unsupported (" + unsupportedCsv + ")"
    32  
    33  	return errcore.
    34  		RangesOnlySupportedType.
    35  		ErrorNoRefs(
    36  			supportedMsg + unsupportedMsg)
    37  }