diff --git a/relayerror/error.go b/relayerror/error.go index 1e26952..f6e1c13 100644 --- a/relayerror/error.go +++ b/relayerror/error.go @@ -27,13 +27,17 @@ func (e *Error) Error() string { } func (e *Error) AddError(err error) *Error { - e.Message = fmt.Sprintf("%s: %s", e.Message, err.Error()) - return e + return NewError( + e.Code, + fmt.Sprintf("%s: %s", e.Message, err.Error()), + ) } func (e *Error) AddMessage(message string) *Error { - e.Message = fmt.Sprintf("%s: %s", e.Message, message) - return e + return NewError( + e.Code, + fmt.Sprintf("%s: %s", e.Message, message), + ) } func (e *Error) Marshal() []byte {