fix: 修复 resp RE 返回时 error 问题
This commit is contained in:
10
resp/resp.go
10
resp/resp.go
@ -68,11 +68,7 @@ H4:
|
|||||||
r.Code = code
|
r.Code = code
|
||||||
}
|
}
|
||||||
H3:
|
H3:
|
||||||
if es, ok := args[2].(error); ok {
|
r.Err = args[2]
|
||||||
r.Err = es.Error()
|
|
||||||
} else {
|
|
||||||
r.Err = args[2]
|
|
||||||
}
|
|
||||||
H2:
|
H2:
|
||||||
r.Data = args[1]
|
r.Data = args[1]
|
||||||
H1:
|
H1:
|
||||||
@ -86,6 +82,10 @@ END:
|
|||||||
r.Msg = Msg(r.Status)
|
r.Msg = Msg(r.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ce, ok := r.Err.(error); ok {
|
||||||
|
r.Err = ce.Error()
|
||||||
|
}
|
||||||
|
|
||||||
c.AbortWithStatusJSON(r.Status, r)
|
c.AbortWithStatusJSON(r.Status, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user