mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-05 09:46:49 +08:00
api error
This commit is contained in:
parent
486e69fd33
commit
1e683fcf95
@ -42,7 +42,11 @@ func apiSuccess(data any) *apiResponse {
|
|||||||
func apiError(err error) *apiResponse {
|
func apiError(err error) *apiResponse {
|
||||||
unwrap := errs.Unwrap(err)
|
unwrap := errs.Unwrap(err)
|
||||||
if codeErr, ok := unwrap.(errs.CodeError); ok {
|
if codeErr, ok := unwrap.(errs.CodeError); ok {
|
||||||
return &apiResponse{ErrCode: codeErr.Code(), ErrMsg: codeErr.Msg(), ErrDlt: codeErr.Detail()}
|
resp := apiResponse{ErrCode: codeErr.Code(), ErrMsg: codeErr.Msg(), ErrDlt: codeErr.Detail()}
|
||||||
|
if resp.ErrDlt == "" {
|
||||||
|
resp.ErrDlt = err.Error()
|
||||||
|
}
|
||||||
|
return &resp
|
||||||
}
|
}
|
||||||
return &apiResponse{ErrCode: errs.ServerInternalError, ErrMsg: err.Error()}
|
return &apiResponse{ErrCode: errs.ServerInternalError, ErrMsg: err.Error()}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user