Created
August 22, 2017 20:23
-
-
Save mrister/99ae9fc43b80e9533b45974d9617bf46 to your computer and use it in GitHub Desktop.
Global catch all AngularJS v2 error handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BrowserModule} from '@angular/platform-browser'; | |
import {ErrorHandler, NgModule} from '@angular/core'; | |
import {AppComponent} from './app.component'; | |
class MyErrorHandler extends ErrorHandler { | |
constructor() { | |
super(); | |
} | |
} | |
@NgModule({ | |
declarations: [AppComponent], | |
imports: [BrowserModule], | |
// add the error handler that , by default, prints to console (basically a decorator) | |
providers: [MyErrorHandler], | |
bootstrap: [AppComponent] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment