JSPM

  • Created
  • Published
  • Downloads 46
  • Score
    100M100P100Q53438F
  • License Apache-2.0

Automated error handling and analytics

Package Exports

  • coderr.client
  • coderr.client/dist/browser.js
  • coderr.client/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (coderr.client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JavaScript library for Coderr

This library is currently available as a release candidate. Feel free to try it, and please give us feedback.

https://coderr.io

This library supports NodeJS and the browser (es6 module). There are also integration libraries that pick up errors automatically from Express, Angular etc.

Installation

Download this package:

npm -I coderr.client

Add it to your application:

import * as coderr from "coderr.client";

coderr.configure("https://reporting.coderr.io", "yourAppKey");

DOM errors will now automatically be reported (for browser-based applications).

To report errors:

import * as coderr from "coderr.client";

try {
    // Do something
    // or to just test:
    throw new Error("Something failed!");
}
catch (e) {
    // You can attach any kind of data.
    coderr.report(e, {userId: 11, address: { City: "Falun" }});
}

Configuration

Coderr detects the environment (production/development) automatically when running in node, for all other types of applications, specify it:

import * as coderr from "coderr.client";

coderr.configuration.environment = 'production';

Application version

To see which application version an error exist, specify it:

import * as coderr from "coderr.client";

coderr.configuration.applicationVersion = '1.1.3';

Example, integration library

You can, for instance, install the Express package:

npm -I coderr.client.expressjs

And then activate it:

import { credentials } from "coderr.client";
import { HttpError, errorMiddleware } from './coderr-error';


credentials("https://coderr.io", "yourAppKey", "yourSharedSecret");

Finally, activate the error middleware as the last middleware:

app.use(errorMiddleware);