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
The core of the issue raised here is that errors themselves (new Error()) can only be distinguished by their error string. So, to compare errors (if a certain error is expected), can only be done by string. Therefore, changing the error string is a breaking issue. The idea here is to make a new class which extends Error, and add extra fields which can help for debug situations.
The nice properties of this is that, if an error gets thrown, one can now:
catch(e: unknown){if(einstanceofEvmError){// error was thrown by evm, handle here}else{// another error (non-EVM) was thrown}}
This old issue raises this idea as well: #1440 along with a discussion: #1439
There is also an old PR open which implements these ideas in a general was (in the util package) and errors in the block package: #1910
The general goal of this issue is:
Ensure that monorepo-wide we align the way of error handling
Errors are easily distinguishable by some kind of error code
This can be done per-package once we have created a way to base-handle these errors. (I will open a PR for this which also handles the errors that way in EVM)
This new EvmError class can be used to get rid of the any / unknown type in the catch blocks to help mature the error propagation in our libraries. See #3700
The text was updated successfully, but these errors were encountered:
This issue summarizes issues/PRs raised in the past to improve monorepo error handling.
An old issue related to this is: #487
The core of the issue raised here is that errors themselves (
new Error()
) can only be distinguished by their error string. So, to compare errors (if a certain error is expected), can only be done by string. Therefore, changing the error string is a breaking issue. The idea here is to make a new class which extends Error, and add extra fields which can help for debug situations.In EVM we already have
EvmError
:The nice properties of this is that, if an error gets thrown, one can now:
This old issue raises this idea as well: #1440 along with a discussion: #1439
There is also an old PR open which implements these ideas in a general was (in the util package) and errors in the block package: #1910
The general goal of this issue is:
This can be done per-package once we have created a way to base-handle these errors. (I will open a PR for this which also handles the errors that way in EVM)
This new
EvmError
class can be used to get rid of theany
/unknown
type in the catch blocks to help mature the error propagation in our libraries. See #3700The text was updated successfully, but these errors were encountered: