-
Notifications
You must be signed in to change notification settings - Fork 34
/
status_error__generated.go
66 lines (55 loc) · 1.25 KB
/
status_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
// This is a generated source file. DO NOT EDIT
// Source: examples/status_error__generated.go
package examples
import "github.com/machinefi/w3bstream/pkg/depends/kit/statusx"
var _ statusx.Error = (*StatusError)(nil)
func (v StatusError) StatusErr() *statusx.StatusErr {
return &statusx.StatusErr{
Key: v.Key(),
Code: v.Code(),
Msg: v.Msg(),
CanBeTalk: v.CanBeTalk(),
}
}
func (v StatusError) Unwrap() error {
return v.StatusErr()
}
func (v StatusError) Error() string {
return v.StatusErr().Error()
}
func (v StatusError) StatusCode() int {
return statusx.StatusCodeFromCode(int(v))
}
func (v StatusError) Code() int {
if with, ok := (interface{})(v).(statusx.ServiceCode); ok {
return with.ServiceCode() + int(v)
}
return int(v)
}
func (v StatusError) Key() string {
switch v {
case Unauthorized:
return "Unauthorized"
case InternalServerError:
return "InternalServerError"
}
return "UNKNOWN"
}
func (v StatusError) Msg() string {
switch v {
case Unauthorized:
return "Unauthorized"
case InternalServerError:
return "InternalServerError 内部错误"
}
return "-"
}
func (v StatusError) CanBeTalk() bool {
switch v {
case Unauthorized:
return true
case InternalServerError:
return false
}
return false
}