-
Notifications
You must be signed in to change notification settings - Fork 179
/
errors.go
54 lines (43 loc) · 1.07 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
package module
import (
"errors"
"fmt"
)
// UnknownBlockError indicates that a referenced block is missing
type UnknownBlockError struct {
err error
}
func NewUnknownBlockError(msg string, args ...interface{}) error {
return UnknownBlockError{
err: fmt.Errorf(msg, args...),
}
}
func (e UnknownBlockError) Unwrap() error {
return e.err
}
func (e UnknownBlockError) Error() string {
return e.err.Error()
}
func IsUnknownBlockError(err error) bool {
var unknownExecutedBlockError UnknownBlockError
return errors.As(err, &unknownExecutedBlockError)
}
// UnknownResultError indicates that a referenced result is missing
type UnknownResultError struct {
err error
}
func NewUnknownResultError(msg string, args ...interface{}) error {
return UnknownResultError{
err: fmt.Errorf(msg, args...),
}
}
func (e UnknownResultError) Unwrap() error {
return e.err
}
func (e UnknownResultError) Error() string {
return e.err.Error()
}
func IsUnknownResultError(err error) bool {
var unknownParentResultError UnknownResultError
return errors.As(err, &unknownParentResultError)
}