Merge pull request #2199 from nspcc-dev/conflicts-message

Reword some error messages
This commit is contained in:
Roman Khimov 2021-09-28 10:17:46 +03:00 committed by GitHub
commit 0ddc7be74d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -22,7 +22,7 @@ var (
// ErrConflict is returned when transaction being added is incompatible // ErrConflict is returned when transaction being added is incompatible
// with the contents of the memory pool (Sender doesn't have enough GAS // with the contents of the memory pool (Sender doesn't have enough GAS
// to pay for all transactions in the pool). // to pay for all transactions in the pool).
ErrConflict = errors.New("conflicts with the memory pool") ErrConflict = errors.New("conflicts: insufficient funds for all pooled tx")
// ErrDup is returned when transaction being added is already present // ErrDup is returned when transaction being added is already present
// in the memory pool. // in the memory pool.
ErrDup = errors.New("already in the memory pool") ErrDup = errors.New("already in the memory pool")

View file

@ -90,6 +90,9 @@ func NewSubmitError(code int64, message string) *Error {
// Error implements the error interface. // Error implements the error interface.
func (e *Error) Error() string { 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) return fmt.Sprintf("%s (%d) - %s - %s", e.Message, e.Code, e.Data, e.Cause)
} }