rpc: detalize submit*
RPC validation error
These changes do not break the compatibility with the C# node response. It is useful for the end-user to be aware of the failed validation reason. Also, the `cause` will be displayed at the running node log.
This commit is contained in:
parent
492a89eb02
commit
2fbbadeb56
2 changed files with 12 additions and 6 deletions
|
@ -93,3 +93,9 @@ func NewSubmitError(code int64, message string) *Error {
|
|||
func (e *Error) Error() string {
|
||||
return fmt.Sprintf("%s (%d) - %s - %s", e.Message, e.Code, e.Data, e.Cause)
|
||||
}
|
||||
|
||||
// WrapErrorWithData returns copy of the given error with specified data and cause.
|
||||
// It does not modify the source error.
|
||||
func WrapErrorWithData(e *Error, data error) *Error {
|
||||
return NewError(e.Code, e.HTTPCode, e.Message, data.Error(), data)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue