mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
998a14c660
* adding roundoff Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * removing unnecessary Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * adding test Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * adding edge case Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * fixing error Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * updating function call Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * updating function jpRound Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * error handling negative Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * fix Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * fix linter Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * parsing Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * cleanup Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix tests Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
22 lines
784 B
Go
22 lines
784 B
Go
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...)
|
|
}
|