Global error handling in Aurelia

Can anyone help me and suggest a way to global error handling in Aurelia like Global Error Handling with Angular2+

Is it possible? any doc or sample?

For rejected promise (most errors from aurelia are unhandled promise rejection), use bluebird global events.

window.addEventListener("unhandledrejection", function(e) {});
window.addEventListener("rejectionhandled", function(e) {});

http://bluebirdjs.com/docs/api/error-management-configuration.html

1 Like

As I remembered we use Bluebird for supporting promises in Edge browser Am I right?

so with your solution we should use Bluebird everywhere Yes?

I thought it is used everywhere. The default bootstrapped aurelia app by cli uses Bluebird by default.

1 Like

Most people swapped out bluebird for a lighter polyfill so that is quite specific unfortunately

2 Likes

@EisenbergEffect, What do you think? Is there any Aurelia based solution for this? (not BlueBird)

Have a look at this method _flushQueue : https://github.com/aurelia/task-queue/blob/master/src/index.js#L100-L135

You can override it and intercept onError by your own global error handler.

1 Like