Navigator Prefabricating Marinates

    raygun-angular2
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.2 • Public • Published

    Raygun for Angular 2

    A pre-packaged Angular 2 addon that attempts to take the hard work out of logging errors with Raygun. Still very much in beta but logs plenty of information already.

    Installation

    From within an Angular2 project

    • npm install raygun-angular2 --save
    • typings install npm:raygun-angular2 --save

    If you are using a similar setup to the Angular2 Quickstart (i.e., using SystemJS) add the following to your System.config:

          System.config({
            packages: {
              'raygun-angular2': {
                  main: 'index.js',
                  defaultExtension: 'js'
              },
              'stack-trace': {
                  main: 'stack-trace.js',
                  defaultExtension: 'js'
              }
            },
            paths: {
                'raygun-angular2': 'node_modules/raygun-angular2/',
                'stack-trace': 'node_modules/stack-trace/lib/'
            }
          });

    Usage

    raygun-angular2 has a dependency on @angular/http so ensure that the bundle is loaded and the provider is bootstrapped in to your application

    import {bootstrap} from '@angular/platform-browser';
    import {provide, ExceptionHandler} from '@angular/core';
    import {HTTP_PROVIDERS} from '@angular/http';
    import {RaygunExceptionHandler} from 'raygun-angular2';
    import {AppComponent} from './appComponent';
    import {ROUTER_PROVIDERS} from '@angular/router';
     
    RaygunExceptionHandler.apiKey = 'Enter API Key here';
     
    bootstrap(AppComponent, [
      ROUTER_PROVIDERS,
      HTTP_PROVIDERS,
      provide(ExceptionHandler, {useClass: RaygunExceptionHandler})
    ]);

    Development Environments

    To prevent errors being reported to Raygun during development use setDevelopmentHostnames to blacklist your local hostnames.

    RaygunExceptionHandler.setDevelopmentHostnames(['localhost']);

    Still To Do

    • Provide public method to set user
    • Fill in gaps in collected information
    • Use X-ApiKey headers rather than a query string, however Raygun currently does not correctly respond to the pre-flight request generated by Angular2.

    Contributors

    Pull requests are always welcome. Please make sure that your work is tested, follows the established code convention and passes the AppVeyor build.

    Install

    npm i raygun-angular2

    DownloadsWeekly Downloads

    45

    Version

    1.1.2

    License

    MIT

    Last publish

    Collaborators

    • terrawheat
    • liberislabs