-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
73 lines (56 loc) · 1.71 KB
/
errors.go
File metadata and controls
73 lines (56 loc) · 1.71 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
package jsonpointer
import (
"errors"
"strconv"
)
var (
ErrArrayIndexOutOfBounds = errors.New("jsonpointer: array index out of bounds")
ErrInvalidArrayIndex = errors.New("jsonpointer: invalid array index")
ErrInvalidPointer = errors.New("jsonpointer: invalid pointer")
ErrValueNotFound = errors.New("jsonpointer: value not found")
)
type arrayIndexOutOfBoundsError struct {
index int
}
func (err *arrayIndexOutOfBoundsError) Error() string {
return "jsonpointer: array index out of bounds " + strconv.Itoa(err.index)
}
func (err *arrayIndexOutOfBoundsError) Is(target error) bool {
return target == ErrArrayIndexOutOfBounds
}
type invalidArrayIndexError struct {
tok string
}
func (err *invalidArrayIndexError) Error() string {
return "jsonpointer: invalid array index " + strconv.QuoteToASCII(err.tok)
}
func (err *invalidArrayIndexError) Is(target error) bool {
return target == ErrInvalidArrayIndex
}
type invalidPointerError struct {
ptr string
}
func (err *invalidPointerError) Error() string {
return "jsonpointer: invalid pointer " + strconv.QuoteToASCII(err.ptr)
}
func (err *invalidPointerError) Is(target error) bool {
return target == ErrInvalidPointer
}
type invalidTokenError struct {
tok string
}
func (err *invalidTokenError) Error() string {
return "jsonpointer: invalid token in pointer " + strconv.QuoteToASCII(err.tok)
}
func (err *invalidTokenError) Is(target error) bool {
return target == ErrInvalidPointer
}
type valueNotFoundError struct {
tok string
}
func (err *valueNotFoundError) Error() string {
return "jsonpointer: value not found " + strconv.QuoteToASCII(err.tok)
}
func (err *valueNotFoundError) Is(target error) bool {
return target == ErrValueNotFound
}