forked from nqmt/goerror
-
Notifications
You must be signed in to change notification settings - Fork 1
/
define.go
75 lines (65 loc) · 1.3 KB
/
define.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
73
74
75
package goerror
import "net/http"
func DefineBadRequest(code, msg string) *GoError {
return &GoError{
Status: http.StatusBadRequest,
Code: code,
Msg: msg,
}
}
func DefineUnauthorized(code, msg string) *GoError {
return &GoError{
Status: http.StatusUnauthorized,
Code: code,
Msg: msg,
}
}
func DefineForbidden(code, msg string) *GoError {
return &GoError{
Status: http.StatusForbidden,
Code: code,
Msg: msg,
}
}
func DefineNotFound(code, msg string) *GoError {
return &GoError{
Status: http.StatusNotFound,
Code: code,
Msg: msg,
}
}
func DefineInternalServerError(code, msg string) *GoError {
return &GoError{
Status: http.StatusInternalServerError,
Code: code,
Msg: msg,
}
}
func DefineNotImplemented(code, msg string) *GoError {
return &GoError{
Status: http.StatusNotImplemented,
Code: code,
Msg: msg,
}
}
func DefineBadGateway(code, msg string) *GoError {
return &GoError{
Status: http.StatusBadGateway,
Code: code,
Msg: msg,
}
}
func DefineServiceUnavailable(code, msg string) *GoError {
return &GoError{
Status: http.StatusServiceUnavailable,
Code: code,
Msg: msg,
}
}
func DefineGatewayTimeout(code, msg string) *GoError {
return &GoError{
Status: http.StatusGatewayTimeout,
Code: code,
Msg: msg,
}
}