-
Notifications
You must be signed in to change notification settings - Fork 174
/
errors.go
50 lines (39 loc) · 1.44 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
package access
import (
"errors"
"fmt"
)
// ErrUnknownReferenceBlock indicates that a transaction references an unknown block.
var ErrUnknownReferenceBlock = errors.New("unknown reference block")
// IncompleteTransactionError indicates that a transaction is missing one or more required fields.
type IncompleteTransactionError struct {
MissingFields []string
}
func (e IncompleteTransactionError) Error() string {
return fmt.Sprintf("transaction is missing required fields: %s", e.MissingFields)
}
// ExpiredTransactionError indicates that a transaction has expired.
type ExpiredTransactionError struct {
RefHeight, FinalHeight uint64
}
func (e ExpiredTransactionError) Error() string {
return fmt.Sprintf("transaction is expired: ref_height=%d final_height=%d", e.RefHeight, e.FinalHeight)
}
// InvalidScriptError indicates that a transaction contains an invalid Cadence script.
type InvalidScriptError struct {
ParserErr error
}
func (e InvalidScriptError) Error() string {
return fmt.Sprintf("failed to parse transaction Cadence script: %s", e.ParserErr)
}
func (e InvalidScriptError) Unwrap() error {
return e.ParserErr
}
// InvalidGasLimitError indicates that a transaction specifies a gas limit that exceeds the maximum.
type InvalidGasLimitError struct {
Maximum uint64
Actual uint64
}
func (e InvalidGasLimitError) Error() string {
return fmt.Sprintf("transaction gas limit (%d) exceeds the maximum gas limit (%d)", e.Actual, e.Maximum)
}