I am trying to create a centralized exception handling (for all code, not just Observable s) in Angular 2, so that in case of an unhandled error, the application does not hang, but logs it. Currently, my application stops responding when an unhandled exception occurs and I have to reload it. I created an error handler 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 thrown when my application crashes. Please help.
source share