0.0.8 • Published 7 years ago

trace-js v0.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Usage

Augular

Angular means Angular 2+ Trace can be configured to catch any Angular-specific (2.x) exceptions reported through the @angular/core/ErrorHandler component.

Installation

$ npm install trace-js --save

Configuration

In your main module file (where @NgModule is called, e.g. app.module.ts)

import Trace = require('trace-js');
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ErrorHandler } from '@angular/core';
import { AppComponent } from './app.component';

Trace.config({
  apiKey: 'your apikey from your server client', // it can be empty string if your server do not configured
  reportUrl: 'http://example.com/api/error' // your server api url to reveive the report
  
  //... other configuration options, see api reference
});

export class TraceErrorHandler implements ErrorHandler {
  handleError(err:any) : void {
    Trace.captureException(err.originalError || err);
  }
}

@NgModule({
  imports: [ BrowserModule ],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ],
  providers: [ { provide: ErrorHandler, useClass: TraceErrorHandler } ]
})
export class AppModule { }

Browser

Trace distributed in a few different methods, and should get included after any other libraries are included, but before your own scripts.

So for example:

<script src="jquery.js"></script>
<script src="trace.min.js"></script>
<script>
  Trace.config({
    apiKey: 'your apikey from your server client', // it can be empty string if your server do not configured
    reportUrl: 'http://example.com/api/error' // your server api url to reveive the report
    
    //... other configuration options, see api reference
  });
</script>
<script src="app.js"></script>
0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1-alpha

7 years ago

0.0.1

7 years ago