All over the tutorial for Angular2 I see that exceptions are being caught right where the call is, e.g.:
getHeroes(): Promise<Hero[]> {
return this.http.get(this.heroesUrl)
.toPromise()
.then(response => response.json().data as Hero[])
.catch(this.handleError);
}
While this might be good for the tutorial, this does not sound sustainable for me. I would like to have some global handler that will e.g. overlay/popup some message to a user and log the error to console + override it when I need some special handling (e.g. if I read the json error and find that I can handle it in a more user-friendly way than just a popup for one of the components), without the need to override it everywhere like the example from Angular2 suggests.
Is it possible to achieve?
P.S. A C# analogue would be some global.asax Application_Error + TaskScheduler.UnobservedTaskException error handling for example.