Skip to content
This repository was archived by the owner on Feb 1, 2021. It is now read-only.

完善sms的返回error的信息 #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sms/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (r *ErrorInfo) ErrorDetail() string {
// Error return error message
func (r *ErrorInfo) Error() string {
if r.Err != "" {
return r.Err
return r.Err + ": " + r.Message
}
return http.StatusText(r.Code)
}
Expand All @@ -234,7 +234,8 @@ func (r *ErrorInfo) HTTPCode() int {
// --------------------------------------------------------------------

type errorRet struct {
Error string `json:"error"`
Error string `json:"error"`
Message string `json:"message"`
}

// ResponseError return response error
Expand All @@ -249,6 +250,7 @@ func ResponseError(resp *http.Response) (err error) {
var ret1 errorRet
json.NewDecoder(resp.Body).Decode(&ret1)
e.Err = ret1.Error
e.Message = ret1.Message
}
}
}
Expand Down