-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patherrors.go
51 lines (39 loc) · 989 Bytes
/
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
package schyntax
import "github.com/schyntax/go-schyntax/internals"
type SchyntaxError interface {
Error() string
Input() string
Index() int
}
var _ SchyntaxError = &internals.ParseError{}
var _ SchyntaxError = &ValidTimeNotFoundError{}
var _ SchyntaxError = &InternalError{}
type ValidTimeNotFoundError struct {
input string
}
func (e *ValidTimeNotFoundError) Error() string {
return "A valid time was not found for the schedule."
}
func (e *ValidTimeNotFoundError) Input() string {
return e.input
}
func (e *ValidTimeNotFoundError) Index() int {
return 0
}
type InternalError struct {
message string
input string
}
func newInternalError(msg string, input string) *InternalError {
msg += " This indicates a bug in Schyntax. Please open an issue on github."
return &InternalError{msg, input}
}
func (e *InternalError) Error() string {
return e.message
}
func (e *InternalError) Input() string {
return e.input
}
func (e *InternalError) Index() int {
return 0
}