error module design bug fix
This commit is contained in:
parent
c8a88914f9
commit
958f77ab90
@ -1,17 +1,17 @@
|
|||||||
package error
|
package error
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
import "github.com/beego/beego/v2/core/codes"
|
"fmt"
|
||||||
|
"github.com/beego/beego/v2/core/codes"
|
||||||
type Code int32
|
)
|
||||||
|
|
||||||
type Error struct {
|
type Error struct {
|
||||||
Code Code
|
Code codes.Code
|
||||||
Msg string
|
Msg string
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a Error representing c and msg.
|
// New returns a Error representing c and msg.
|
||||||
func New(c Code, msg string) *Error {
|
func New(c codes.Code, msg string) *Error {
|
||||||
return &Error{Code: c, Msg: msg}
|
return &Error{Code: c, Msg: msg}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ func (e *Error) Error() string {
|
|||||||
return fmt.Sprintf("beego error: code = %s desc = %s", e.GetCode(), e.GetMessage())
|
return fmt.Sprintf("beego error: code = %s desc = %s", e.GetCode(), e.GetMessage())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Error) GetCode() Code {
|
func (x *Error) GetCode() codes.Code {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Code
|
return x.Code
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user