-
Notifications
You must be signed in to change notification settings - Fork 5
/
error.go
35 lines (27 loc) · 1.11 KB
/
error.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
package main
import (
"fmt"
)
const (
HTTPStatusCodeError = "status code non 200"
InvalidUnitError = "ERROR: unrecognized unit: "
Default
)
func NewHTTPStatusCode(code int, body string) error {
return fmt.Errorf(HTTPStatusCodeError+": %d: With body %s", code, body)
}
func NewInvalidStartEndError(s, e int64, unit string) error {
return fmt.Errorf("ERROR: unable to interpret timeline: (Start) %d%s Ago to (End) %d%s Ago is not a valid range. Start must come before End", s, unit, e, unit)
}
func NewInvalidUnitError(unit string) error {
return fmt.Errorf("ERROR: %s%s, valid units: (minutes, hours, days, weeks, blocks, sessions)", InvalidUnitError, unit)
}
func NewInvalidMinimumHeightError(minHeight int64) error {
return fmt.Errorf("ERROR: the start height is less than 0 (%d), ensure your pocket client is synced and the start and end values are within bounds", minHeight)
}
func NewProofMsgInterfaceError() error {
return fmt.Errorf("ERROR: unable to convert interface to ProofMsg")
}
func NewPublicKeyError() error {
return fmt.Errorf("ERROR: unable to convert string public key into ED25519 public key")
}