-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Looking for a way to report unhandled c++ exceptions to 3rd party crash reporting system #22613
Comments
IIUC the way this is normally done on the web is to install a global exception handler on your page and report all unhandled exceptions that way. Exceptions thrown from native code (when using I think the window.onerror handler is the way to install a global error handler (at least on the web). @aheejin might know more here. |
@sbc100 thanks for reply and thoughts. Yes, we're working on web solution. The problem with To be honest, plugging into Side note: |
So in addition to One way to do this would be to ask you users to call your exception reporting function whenever they catch and ignore exceptions from your code. Another way would be something like Lines 525 to 602 in 543993e
|
I'm not sure if I understood your request correctly. When And whenever you have that exception object in JS, you can access its I guess I don't understand what the problem is correctly. Can you elaborate more? |
@aheejin, @sbc100 thanks for replies 🙌
Sure! Here's the thing:
This is specifically something I try to avoid.
The challenge now is to get correct stack trace as
Do you see a good/correct way to distinguish these two scenarios in As a side note: do you think |
So just to be clear, if I'm a user of your library, and your library crashes as part of my application, you want the crash report to go to your server by default? Wouldn't that be something that I, as the user of the library, would want to opt into explictly? |
Or is this actually a normal/common thing to do in the world of JS libraries? (I'm not super familiar with the latest JS library trends). |
To be specific: this is internal library used by multiple client apps within our organisation. That being said this behaviour is opt-in and available behind a setting passed during library setup. I want to keep it this way: one time configuration and no more responsibility on client app side for this to work. |
@sbc100 our current idea for getting the access to correct call stack is to use |
there is a try .. catch in side handleMessage of file |
This is a question, not a bug.
We're trying to find a generic way to report stack traces for all exceptions unhandled in c++ (meaning: also for c++ exceptions that are handled in JS). We're using
-fwasm-exceptions
and-sEXCEPTION_STACK_TRACES
.We found out that Emscripten's
___throw_exception_with_stack_trace
JS function is called whenever c++ exception is thrown. What we'd like to do is plug into this function, so we can get a stack trace and send it to 3rd party crash reporting system.We've been trying different approaches, but had little to no success. We're looking for any guidance, or the reason for why it is bad/wrong idea in the first place.
Version of emscripten/emsdk:
The text was updated successfully, but these errors were encountered: