2023-02-06 15:13:44 +01:00
|
|
|
package jmespath
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
errorPrefix = "JMESPath function '%s': "
|
2023-06-19 15:45:13 +02:00
|
|
|
invalidArgumentTypeError = errorPrefix + "argument #%d is not of type %s"
|
2023-02-06 15:13:44 +01:00
|
|
|
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"
|
2023-02-06 16:01:39 +01:00
|
|
|
typeMismatchError = errorPrefix + "Types mismatch"
|
2023-07-04 01:01:54 +05:30
|
|
|
nonIntRoundError = errorPrefix + "Non-integer argument(s) passed for round off"
|
2023-02-06 15:13:44 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func formatError(format string, function string, values ...interface{}) error {
|
|
|
|
args := []interface{}{function}
|
|
|
|
args = append(args, values...)
|
|
|
|
return fmt.Errorf(format, args...)
|
|
|
|
}
|