You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As previously discussed in #487, stringified error messages are not a reliable solution long-term.
The alernatives discussed are:
Replacing error strings with an enum
Extending the error object with our own custom errors
The approach that Richard uses in Ethers v6 (custom errors with type guards)
I think that approaches 2 and 3 are better than 1 since they give us the benefit of predictable/easily testable errors (we just check the type of error) but keeping the flexibility of messages.
This is the usage that I'd have in mind:
// Usage
throw new TransactionError('Transaction reverted because gas limit was too low')
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As previously discussed in #487, stringified error messages are not a reliable solution long-term.
The alernatives discussed are:
I think that approaches 2 and 3 are better than 1 since they give us the benefit of predictable/easily testable errors (we just check the type of error) but keeping the flexibility of messages.
This is the usage that I'd have in mind:
Related issue: #1440
Beta Was this translation helpful? Give feedback.
All reactions