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

Promises: Unhandled rejections #32

Open
frankebersoll opened this issue Oct 11, 2015 · 1 comment
Open

Promises: Unhandled rejections #32

frankebersoll opened this issue Oct 11, 2015 · 1 comment
Labels

Comments

@frankebersoll
Copy link
Contributor

@frankebersoll frankebersoll commented Oct 11, 2015

One big issue with exception handling in JavaScript is Promises: When you don't explicitly handle an error using a rejection callback, most Promise libraries provide global events like Promise.onPossiblyUnhandledRejection (bluebird.js), Q.getUnhandledReasons (Q.js) or process.on('unhandledRejection) (Node.js). Not subscribing to those events when using Promises probably contributes to many programmer errors staying unnoticed, as the application won't neccessarily terminate.

It would be cool if Exceptionless.js checked for the existence of such modules and events and created handlers that automatically submit the exceptions. While we do that, we should refactor all global exception handlers into implementations of an interface that can be added to the configuration like plugins.

Name proposals:

  • IGlobalExceptionHandler
  • IExceptionHook
  • IExceptionSource
@ejsmith
Copy link
Member

@ejsmith ejsmith commented Oct 11, 2015

Seems like this can just be plugins for each technology. So you would wire up to Promise.onPossiblyUnhandledRejection and then submit the event from inside the handler. We are already doing something very similar here:

https://github.com/exceptionless/Exceptionless.JavaScript/blob/master/src/integrations/angular.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.