Skip to content
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

Web Worker error notifying #172

Closed
jmshal opened this issue Aug 8, 2016 · 8 comments
Closed

Web Worker error notifying #172

jmshal opened this issue Aug 8, 2016 · 8 comments
Labels
feature request Request for a new feature released This feature/bug fix has been released

Comments

@jmshal
Copy link

jmshal commented Aug 8, 2016

Right now you can technically catch errors from Workers by listening to it's onerror event. However it seems (at a first glance) that the stacktrace is lost. It might be worth having an additional (tiny) script to import within a worker which basically proxies the error & stacktrace back to the main thread for it to notify (making the worker completely config-less).

I still have to see what's technically possible, but I'm pretty confident it can be done.

Thoughts?

@kattrali kattrali added the needs discussion Requires internal analysis/discussion label Aug 13, 2016
@kattrali
Copy link
Contributor

Thanks for the report, @jacobmarshall. Seems like kinda of a hairy issue, but I'm open to ideas. 🤔 @eanakashima @wordofchristian might also have some thoughts.

@jmshal
Copy link
Author

jmshal commented Aug 13, 2016

I think it would be very reliant on how #170 turns out.

@foxyblocks
Copy link

Does #170 solve the stacktrace problem, or is more required?

@jmshal
Copy link
Author

jmshal commented Aug 15, 2016

More is required, as the error needs to be caught from within the worker in order to extract the stacktrace. If you'd like I can combine this into #170?

@bengourley
Copy link
Contributor

As with #170, we are going to pick this up in the next major.

@JacobEvelyn
Copy link

It appears that a major release has come and gone since that last ^ comment. Is this still planned?

@JacobEvelyn
Copy link

For anyone here who saw @jmshal's statement

Right now you can technically catch errors from Workers by listening to its onerror event.

and is wondering how to actually do that, I dug through the code for a while and eventually came up with this:

worker.onerror = function(errorEvent) {
  const bugsnagReport = new bugsnagClient.BugsnagReport(
    "worker.onerror",
    errorEvent.message,
    [
      {
        fileName: errorEvent.filename,
        lineNumber: errorEvent.lineno,
        columnNumber: errorEvent.colno
      }
    ],
    {
      severity: "error",
      unhandled: true,
      severityReason: { type: "unhandledException" }
    }
  );

  bugsnagClient.notify(bugsnagReport);
};

Since the ErrorEvent interface is used for every error event except for window.onerror, I wonder if it makes sense to allow Bugsnag.notify to take an ErrorEvent and just change Bugsnag's window.onerror (which does not pass an ErrorEvent—see MDN doc) to window.addEventListener("error", ...) (which does). Thoughts?

@snmaynard snmaynard added feature request Request for a new feature and removed next major labels Oct 26, 2018
@xljones xljones added the backlog We hope to fix this feature/bug in the future label Feb 19, 2021
@johnkiely1
Copy link
Member

Hi all, just writing to let you know that we recently released support for Web Workers in bugsnag-js:
https://github.com/bugsnag/bugsnag-js/releases/tag/v7.20.0

You can read more about this in our docs:
https://docs.bugsnag.com/platforms/javascript/web-workers/

@johnkiely1 johnkiely1 added released This feature/bug fix has been released and removed backlog We hope to fix this feature/bug in the future labels Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature released This feature/bug fix has been released
Projects
None yet
Development

No branches or pull requests

8 participants