1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 23:46:56 +00:00
kyverno/pkg/engine/jmespath/error.go

23 lines
784 B
Go
Raw Normal View History

package jmespath
import (
"fmt"
)
const (
errorPrefix = "JMESPath function '%s': "
invalidArgumentTypeError = errorPrefix + "argument #%d is not of type %s"
genericError = errorPrefix + "%s"
argOutOfBoundsError = errorPrefix + "%d argument is out of bounds (%d)"
zeroDivisionError = errorPrefix + "Zero divisor passed"
nonIntModuloError = errorPrefix + "Non-integer argument(s) passed for modulo"
typeMismatchError = errorPrefix + "Types mismatch"
nonIntRoundError = errorPrefix + "Non-integer argument(s) passed for round off"
)
func formatError(format string, function string, values ...interface{}) error {
args := []interface{}{function}
args = append(args, values...)
return fmt.Errorf(format, args...)
}