-
Notifications
You must be signed in to change notification settings - Fork 139
Throw strings #53
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
Throw strings #53
Conversation
|
Fixes #47 |
|
Not LGTM This change is ugly and driven by TraceKit. I saw that TraceKit tries to throw exception and then catches it in window.onerror handler. I don't understand what it tries to achieve, but it should not break notifier design. Can we find another way to fix TraceKit?
How I am supposed to use exceptions then? |
|
It's driven by TraceKit because TraceKit uses the rethrow information to populate additional information on errors captured by There are two pending changes in TraceKit that should obviate the need for this behavior, occ/TraceKit#49 and occ/TraceKit#54 Please feel free to weigh in on those TraceKit issues. It is a strange API that allows you to throw and handle exceptions, but not to actually use them as a form of flow control. Alternatively, we can use the fallback processor that bypasses |
|
To be clear, I think pulling TraceKit in order to support this very normal usage of exceptions is entirely reasonable. |
Are you sure that it is tested only for Chrome? I thought this is the only method to get stacktrace from exception.
There are opinions that exceptions should not be used for flow control. But our case is much simpler. There is no reasons to make |
|
So as I understand the problem is that So I think we should:
|
|
First, since we use a shim implementation, Second, when the canonical implementation comes in, it processes through the errors pushed onto the shim, and processes any new errors immediately. To maintain a consistent interface between these, neither one ever throws immediately, meaning exceptions can't be used as flow control. However, any errors thrown will be re-raised to window for viewing in the console or whatever. Perhaps something simpler would be to pull all this plumbing out and simply let |
This pull request started out trying to handle the case where users throw strings in JavaScript and quickly led to a pretty major change in the operation of
Airbrake.pushAirbrake.pushnow throws the error passed to it after reporting is completed. This parallels the behavior of TraceKit'sreportexcept the error may not actually be thrown during the execution of thepush, and instead may be rethrown sometime later.