-
Notifications
You must be signed in to change notification settings - Fork 252
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
Add asyncNotifyException method (for one-level deep async stacktraces) #242
Conversation
Tested in Chrome, Safari and Firefox. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jmshal, this looks like a cool little hack until such time where we support long/async stack traces!
I'm on the fence about whether it is worthwhile adding as a feature, just because I think it will be confusing to explain/document, and also needs manual intervention to every async action to get set up.
Let me know if you're still keen to get this merged and if so, we could perhaps support it but not widely advertise/document it.
Couple of nit picks left as comments and also this would definitely need a test or two.
@@ -66,6 +78,36 @@ | |||
// ### Manual error notification (public methods) | |||
// | |||
|
|||
// #### Bugsnag.autoNotifyException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should say asyncNotifyException
try { | ||
throw Error(''); | ||
} catch(err) { | ||
stacktraceName = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comment on which browsers use which error property for the stack trace would be nice.
Thanks @bengourley! I have my own doubts about this actually making it into the notifier. I feel at this point that it would be better if it was detailed within the docs (as a snippet), simply because of it's small size & very specific use-case. Although I do see this as a hack, I also feel like this is the best we're going to get, at least for a while - I spent a lot of time, and tried a bunch of different methods, but I settled on this as it was the least "involved". I usually like to stay optimistic about these things, but I don't think I've really seen this area of JS evolve much. |
I very much agree with this. I'll close this PR but thanks your efforts in this area! Async tracing is definitely an area JS needs to catch up in… Node's async hooks are a start but it sounds like TC39 are (or will be) working on something for native JS, which means we're probably in for a rocky ride of incompatibility/competing standards in the future! |
See #241 (comment) for more context & example.