-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
154 lines (115 loc) · 3.76 KB
/
errors.go
File metadata and controls
154 lines (115 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package jmespath
import (
"errors"
"strconv"
)
var (
// ErrEvaluationFailed indicates that the evaluation of the expression
// failed with an error.
ErrEvaluationFailed = errors.New("jmespath: evaluation failed")
// ErrInvalidArity indicates that the expression called a function with an
// incorrect number of arguments.
ErrInvalidArity = errors.New("jmespath: invalid arity")
// ErrInvalidType indicates that a field was used in a context where its
// type wasn't valid.
ErrInvalidType = errors.New("jmespath: invalid type")
// ErrInvalidValue indicates that a field was used in a context where its
// value wasn't valid.
ErrInvalidValue = errors.New("jmespath: invalid value")
// ErrNotANumber indicates that the an operation produced an infinity or
// not-a-number result.
ErrNotANumber = errors.New("jmespath: not a number")
// ErrSyntax indicates that the expression contains a syntax error.
ErrSyntax = errors.New("jmespath: syntax error")
// ErrUndefinedVariable indicates that the expression attempted to access a
// variable that hadn't been defined.
ErrUndefinedVariable = errors.New("jmespath: undefined variable")
// ErrUnknownFunction indicates that the expression attempted to invoke a
// function that hasn't been defined.
ErrUnknownFunction = errors.New("jmespath: unknown function")
)
type evaluationFailedError struct {
msg string
}
func (err *evaluationFailedError) Error() string {
return "jmespath: evaluation failed: " + err.msg
}
func (err *evaluationFailedError) Is(target error) bool {
return target == ErrEvaluationFailed
}
type infinityError struct{}
func (err *infinityError) Error() string {
return "jmespath: result of operation is an infinity"
}
func (err *infinityError) Is(target error) bool {
return target == ErrNotANumber
}
type invalidFunctionCallError struct {
function string
}
func (err *invalidFunctionCallError) Error() string {
return "jmespath: invalid call to funcation " + strconv.Quote(err.function)
}
func (err *invalidFunctionCallError) Is(target error) bool {
return target == ErrInvalidArity
}
type invalidExpressionError struct {
expression string
msg string
}
func (err *invalidExpressionError) Error() string {
return "jmespath: invalid expression " + strconv.Quote(err.expression) + ": " + err.msg
}
func (err *invalidExpressionError) Is(target error) bool {
return target == ErrSyntax
}
type invalidSliceStepError struct{}
func (err *invalidSliceStepError) Error() string {
return "jmespath: invalid slice step value"
}
func (err *invalidSliceStepError) Is(target error) bool {
return target == ErrInvalidValue
}
type invalidTypeError struct {
msg string
}
func (err *invalidTypeError) Error() string {
return "jmespath: " + err.msg
}
func (err *invalidTypeError) Is(target error) bool {
return target == ErrInvalidType
}
type invalidValueError struct {
msg string
}
func (err *invalidValueError) Error() string {
return "jmespath: " + err.msg
}
func (err *invalidValueError) Is(target error) bool {
return target == ErrInvalidValue
}
type notANumberError struct{}
func (err *notANumberError) Error() string {
return "jmespath: result of operation is not a number"
}
func (err *notANumberError) Is(target error) bool {
return target == ErrNotANumber
}
type undefinedVariableError struct {
variable string
}
func (err *undefinedVariableError) Error() string {
return "jmespath: undefined variable " + strconv.Quote(err.variable)
}
func (err *undefinedVariableError) Is(target error) bool {
return target == ErrUndefinedVariable
}
type unknownFunctionError struct {
function string
}
func (err *unknownFunctionError) Error() string {
return "jmespath: unknown function " + strconv.Quote(err.function)
}
func (err *unknownFunctionError) Is(target error) bool {
return target == ErrUnknownFunction
}