修复错误处理逻辑,创建服务错误返回指针
This commit is contained in:
@@ -165,12 +165,12 @@ func (e ServiceErr) Error() string {
|
||||
return e.msg
|
||||
}
|
||||
|
||||
func NewErr(name, msg string, code ...int) ServiceErr {
|
||||
func NewErr(name, msg string, code ...int) *ServiceErr {
|
||||
_code := 400
|
||||
if len(code) > 0 {
|
||||
_code = code[0]
|
||||
}
|
||||
return ServiceErr{
|
||||
return &ServiceErr{
|
||||
name: name,
|
||||
msg: msg,
|
||||
code: _code,
|
||||
|
||||
Reference in New Issue
Block a user