I'm trying to create centralized exception handling (for all code not just Observable
s) in Angular 2, so that if there is an unhandled error it won't crash the application, but will log it. At the moment my application becomes unresponsive when there is an unhandled exception and I have to reload it. I've created an errorhandler as follows:
import { NgModule, ErrorHandler } from '@angular/core';
export class AppErrorHandler implements ErrorHandler
{
rethrowError = false;
handleError(error: any)
{
}
}
Unhandled errors do go to handleError()
, but seem to be re-thrown as my application stops working. Please help.