-
Notifications
You must be signed in to change notification settings - Fork 34
/
error__generated.go
72 lines (61 loc) · 1.24 KB
/
error__generated.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
66
67
68
69
70
71
72
// This is a generated source file. DO NOT EDIT
// Source: jwt/error__generated.go
package jwt
import "github.com/machinefi/w3bstream/pkg/depends/kit/statusx"
var _ statusx.Error = (*Error)(nil)
func (v Error) StatusErr() *statusx.StatusErr {
return &statusx.StatusErr{
Key: v.Key(),
Code: v.Code(),
Msg: v.Msg(),
CanBeTalk: v.CanBeTalk(),
}
}
func (v Error) Unwrap() error {
return v.StatusErr()
}
func (v Error) Error() string {
return v.StatusErr().Error()
}
func (v Error) StatusCode() int {
return statusx.StatusCodeFromCode(int(v))
}
func (v Error) Code() int {
if with, ok := (interface{})(v).(statusx.ServiceCode); ok {
return with.ServiceCode() + int(v)
}
return int(v)
}
func (v Error) Key() string {
switch v {
case Unauthorized:
return "Unauthorized"
case InvalidToken:
return "InvalidToken"
case InvalidClaim:
return "InvalidClaim"
}
return "UNKNOWN"
}
func (v Error) Msg() string {
switch v {
case Unauthorized:
return ""
case InvalidToken:
return "Invalid Token"
case InvalidClaim:
return "Invalid Claim"
}
return "-"
}
func (v Error) CanBeTalk() bool {
switch v {
case Unauthorized:
return false
case InvalidToken:
return true
case InvalidClaim:
return true
}
return false
}