-
Notifications
You must be signed in to change notification settings - Fork 175
/
errors.go
65 lines (52 loc) · 1.71 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
package mempool
import (
"errors"
"fmt"
)
// UnknownExecutionResultError indicates that the Execution Result is unknown
type UnknownExecutionResultError struct {
err error
}
func NewUnknownExecutionResultError(msg string) error {
return NewUnknownExecutionResultErrorf(msg)
}
func NewUnknownExecutionResultErrorf(msg string, args ...interface{}) error {
return UnknownExecutionResultError{
err: fmt.Errorf(msg, args...),
}
}
func (e UnknownExecutionResultError) Unwrap() error {
return e.err
}
func (e UnknownExecutionResultError) Error() string {
return e.err.Error()
}
// IsUnknownExecutionResultError returns whether the given error is an UnknownExecutionResultError error
func IsUnknownExecutionResultError(err error) bool {
var unknownExecutionResultError UnknownExecutionResultError
return errors.As(err, &unknownExecutionResultError)
}
// DecreasingPruningHeightError indicates that we are pruning a mempool by a height that
// is lower than existing height
type DecreasingPruningHeightError struct {
err error
}
func NewDecreasingPruningHeightError(msg string) error {
return NewDecreasingPruningHeightErrorf(msg)
}
func NewDecreasingPruningHeightErrorf(msg string, args ...interface{}) error {
return DecreasingPruningHeightError{
err: fmt.Errorf(msg, args...),
}
}
func (e DecreasingPruningHeightError) Unwrap() error {
return e.err
}
func (e DecreasingPruningHeightError) Error() string {
return e.err.Error()
}
// IsDecreasingPruningHeightError returns whether the given error is an DecreasingPruningHeightError error
func IsDecreasingPruningHeightError(err error) bool {
var newIsDecreasingPruningHeightError DecreasingPruningHeightError
return errors.As(err, &newIsDecreasingPruningHeightError)
}