mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 02:55:58 +08:00
code error
This commit is contained in:
@@ -19,12 +19,8 @@ func apiSuccess(data any) *apiResponse {
|
||||
|
||||
func apiError(err error) *apiResponse {
|
||||
unwrap := errs.Unwrap(err)
|
||||
var dlt string
|
||||
if unwrap != err {
|
||||
dlt = err.Error()
|
||||
}
|
||||
if codeErr, ok := unwrap.(errs.CodeError); ok {
|
||||
return &apiResponse{ErrCode: codeErr.Code(), ErrMsg: codeErr.Msg(), ErrDlt: dlt}
|
||||
return &apiResponse{ErrCode: codeErr.Code(), ErrMsg: codeErr.Msg(), ErrDlt: codeErr.Detail()}
|
||||
}
|
||||
return &apiResponse{ErrCode: errs.ServerInternalError, ErrMsg: err.Error(), ErrDlt: dlt}
|
||||
return &apiResponse{ErrCode: errs.ServerInternalError, ErrMsg: err.Error()}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user