Last active
July 14, 2018 06:10
-
-
Save fizerkhan/b1ef10f72efe8f9fc9b0e0756969208f to your computer and use it in GitHub Desktop.
Atatus Angular 2+ Integrations
This file contains 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
// /app/app.module.ts | |
import { ErrorHandler } from '@angular/core'; | |
import { AppComponent } from './app.component'; | |
import AtatusErrorHandler from './atatus.handler'; | |
@NgModule({ | |
bootstrap: [AppComponent], | |
declarations: [AppComponent], | |
providers: [{provide: ErrorHandler, useClass: AtatusErrorHandler}] | |
}) | |
export class AppModule { } |
This file contains 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
// /app/atatus.handler.ts | |
import { ErrorHandler } from '@angular/core'; | |
import * as atatus from 'atatus-js'; | |
atatus.config('YOUR_API_KEY').install(); | |
class AtatusErrorHandler implements ErrorHandler { | |
handleError(error:any) : void { | |
if (atatus) { | |
// Send the error to Atatus | |
atatus.notify(error.originalError || error); | |
} | |
} | |
} | |
export default AtatusErrorHandler; |
This file contains 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
npm install atatus-js --save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment