-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
50 lines (40 loc) · 884 Bytes
/
Copy patherrors.go
File metadata and controls
50 lines (40 loc) · 884 Bytes
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 cronbeatsgo
import "fmt"
type ApiErrorCode string
const (
CodeValidation ApiErrorCode = "VALIDATION_ERROR"
CodeNotFound ApiErrorCode = "NOT_FOUND"
CodeRateLimit ApiErrorCode = "RATE_LIMITED"
CodeServer ApiErrorCode = "SERVER_ERROR"
CodeNetwork ApiErrorCode = "NETWORK_ERROR"
CodeUnknown ApiErrorCode = "UNKNOWN_ERROR"
)
type ValidationError struct {
Message string
}
func (e *ValidationError) Error() string {
return e.Message
}
type SdkError struct {
Message string
Cause error
}
func (e *SdkError) Error() string {
if e.Cause == nil {
return e.Message
}
return fmt.Sprintf("%s: %v", e.Message, e.Cause)
}
func (e *SdkError) Unwrap() error {
return e.Cause
}
type ApiError struct {
Code ApiErrorCode
HTTPStatus *int
Retryable bool
Message string
Raw any
}
func (e *ApiError) Error() string {
return e.Message
}