File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package ecode
2
2
3
3
import (
4
4
"gin_example_with_generic/pkg/errors"
5
+ "net/http"
5
6
)
6
7
7
8
type ErrCode struct {
@@ -10,19 +11,19 @@ type ErrCode struct {
10
11
Message string
11
12
}
12
13
13
- func (coder ErrCode ) Code () int {
14
- return coder .ErrCode
14
+ func (e * ErrCode ) Code () int {
15
+ return e .ErrCode
15
16
}
16
17
17
- func (coder ErrCode ) String () string {
18
- return coder .Message
18
+ func (e * ErrCode ) String () string {
19
+ return e .Message
19
20
}
20
21
21
- func (coder ErrCode ) HTTPStatus () int {
22
- if coder .HttpStatus == 0 {
23
- return 500
22
+ func (e * ErrCode ) HTTPStatus () int {
23
+ if e .HttpStatus == 0 {
24
+ return http . StatusInternalServerError
24
25
}
25
- return coder .HttpStatus
26
+ return e .HttpStatus
26
27
}
27
28
28
29
func register (code int , httpStatus int , message string ) {
You can’t perform that action at this time.
0 commit comments