Skip to content

Instantly share code, notes, and snippets.

@fizerkhan
Last active July 14, 2018 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fizerkhan/b1ef10f72efe8f9fc9b0e0756969208f to your computer and use it in GitHub Desktop.
Save fizerkhan/b1ef10f72efe8f9fc9b0e0756969208f to your computer and use it in GitHub Desktop.
Atatus Angular 2+ Integrations
// /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 { }
// /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;
npm install atatus-js --save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment