-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exceptions should be passed as a class, and not an instance in order to simplify error stack trace #22
Comments
This would be a breaking change, and would require fixes to all other downstream repos to change to the class. A large find & replace. |
In the It would give us a useful stack trace during debugging. |
This will be scheduled for version 2 since it's a breaking change. |
That means the |
This means for example in the function Instead it should take Same for the |
…p and destroy * take note that `CreateDestroyStartStop` takes an event dictionary, this can be replaced in the future with an entire arg dictionary, this should be done along with #22 and ESM migration as it is a breaking change
See #32. It has to be done first, before this issue can be resolved. Then a mass ESM migration can occur at the same time as doing the this issue's breaking changes. The Then breaking changes mean:
|
Is your feature request related to a problem? Please describe.
The error stack trace is created when the error instance is constructed, not where it is thrown.
Atm, we fix this by overriding the error instance's stack trace at thrown time.
Describe the solution you'd like
If we take a class instead, we can just instantiate the class and then expect that the error instance is constructed. Even more general would be a function returning an error instance...
This will make the stack trace start from where it is thrown. But we may still need to "reset" it according to the decorated function, as that will give us a cleaner trace... but it assumes we don't need to know exactly where it is thrown. It's a bit more "magical".
I'm already trialling this out in the
timed
decorator and other context decorators.Additional context
The text was updated successfully, but these errors were encountered: