Global error handling in Aurelia


#1

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?


#2

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


#3

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?


#4

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


#5

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


#6

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


#7

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.