diff --git a/pkg/apiresp/resp.go b/pkg/apiresp/resp.go index 688fc5b6a..06001a541 100644 --- a/pkg/apiresp/resp.go +++ b/pkg/apiresp/resp.go @@ -42,7 +42,11 @@ func apiSuccess(data any) *apiResponse { func apiError(err error) *apiResponse { unwrap := errs.Unwrap(err) 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()} }