forked from TrueCloudLab/neoneo-go
rpc/response: beautify error message
If `Error.Cause` is nil, omit ugly `%s!<nil>`. Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
e6aa9b76ee
commit
45976a4111
1 changed files with 3 additions and 0 deletions
|
@ -90,6 +90,9 @@ func NewSubmitError(code int64, message string) *Error {
|
|||
|
||||
// Error implements the error interface.
|
||||
func (e *Error) Error() string {
|
||||
if e.Cause == nil {
|
||||
return fmt.Sprintf("%s (%d) - %s", e.Message, e.Code, e.Data)
|
||||
}
|
||||
return fmt.Sprintf("%s (%d) - %s - %s", e.Message, e.Code, e.Data, e.Cause)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue