MCPcopy
hub / github.com/cortexlabs/cortex / ErrorWrongNumberOfElements

Function ErrorWrongNumberOfElements

pkg/lib/configreader/errors.go:344–359  ·  view source on GitHub ↗
(invalidLengths []int)

Source from the content-addressed store, hash-verified

342}
343
344func ErrorWrongNumberOfElements(invalidLengths []int) error {
345 invalidElementsStr := "elements"
346 if len(invalidLengths) == 1 && invalidLengths[0] == 1 {
347 invalidElementsStr = "element"
348 }
349
350 invalidLengthStrs := make([]string, len(invalidLengths))
351 for i, length := range invalidLengths {
352 invalidLengthStrs[i] = s.Int(length)
353 }
354
355 return errors.WithStack(&errors.Error{
356 Kind: ErrWrongNumberOfElements,
357 Message: fmt.Sprintf("cannot contain %s %s", s.StrsOr(invalidLengthStrs), invalidElementsStr),
358 })
359}
360
361func ErrorCannotSetStructField() error {
362 return errors.WithStack(&errors.Error{

Callers 9

validateFloat64ListFunction · 0.85
validateInt32ListFunction · 0.85
validateBoolListFunction · 0.85
validateIntListFunction · 0.85
StructListFunction · 0.85
validateInt64ListFunction · 0.85
validateInterfaceMapListFunction · 0.85
validateStringListFunction · 0.85
validateFloat32ListFunction · 0.85

Calls 1

WithStackFunction · 0.92

Tested by

no test coverage detected