-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
89 lines (64 loc) · 1.53 KB
/
errors.go
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
package yt
import "fmt"
type ErrNotImplemented struct {
Functionality string
}
func (ni ErrNotImplemented) Error() string {
return fmt.Sprintf("not implemented: %s", ni.Functionality)
}
type ErrEmptyToken struct{}
func (et ErrEmptyToken) Error() string {
return fmt.Sprintf("empty token")
}
type ErrInvalidEscapeChar struct {
Rune rune
}
func (ie ErrInvalidEscapeChar) Error() string {
return fmt.Sprintf("invalid escape character: %v", ie.Rune)
}
type ErrUnexpectedRune struct {
Rune rune
}
func (uc ErrUnexpectedRune) Error() string {
return fmt.Sprintf("unexpected rune: %s", string(uc.Rune))
}
type ErrUnknown struct {
Message string
}
func (u ErrUnknown) Error() string {
return u.Message
}
type ErrExpectedMap struct{}
func (em ErrExpectedMap) Error() string {
return "expected map"
}
type ErrKeyNotFound struct {
Key string
}
func (knf ErrKeyNotFound) Error() string {
return fmt.Sprintf("not found: %s", knf.Key)
}
type ErrExpectedArray struct{}
func (ea ErrExpectedArray) Error() string {
return "expected array"
}
type ErrOutOfBounds struct{}
func (oob ErrOutOfBounds) Error() string {
return "index out of bounds"
}
type ErrKeyAlreadyDefined struct {
Key string
}
func (kc ErrKeyAlreadyDefined) Error() string {
return fmt.Sprintf("key already defined: %s", kc.Key)
}
type ErrInvalidQuery struct{}
func (iq ErrInvalidQuery) Error() string {
return "invalid query"
}
type ErrCycleDetected struct {
Source string
}
func (cd ErrCycleDetected) Error() string {
return fmt.Sprintf("cycle detected: %s", cd.Source)
}