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

Question : Global Error handling in Promise #840

Closed
stripathix opened this issue Sep 24, 2018 · 2 comments
Closed

Question : Global Error handling in Promise #840

stripathix opened this issue Sep 24, 2018 · 2 comments

Comments

@stripathix
Copy link

Any error occurring inside Promise is silent if I dont have try/catch or use .catch() after then() function.

In AngularJs there is a Service $q which handles promises but any error occurring inside promise is reported and logged in the console. But with Q service https://github.com/kriskowal/q I am not getting any log in the console if any error occurs inside.

I don't want to put .catch() after every then() function.

How to catch all unhandled exceptions in Promises

@stripathix stripathix changed the title Global Error handling in Prmises Question : Global Error handling in Promise Sep 24, 2018
@benjamingr
Copy link
Collaborator

I PR'd this in a while back (3 years ago?)

You listen to the unhandledRejection event on process which gets called whenever a promise rejection was not handled for a microtick - listen to rejectionHandled to catch false positives. In browser environment there are similar events (I forgot how I called them in Q but you can define a global process event emitter).

@benjamingr
Copy link
Collaborator

Ref #643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants