npm.io
0.2.0 • Published 7 years ago

paperplane-bugsnag

Licence
MIT
Version
0.2.0
Deps
2
Size
5 kB
Vulns
0
Weekly
0

paperplane-bugsnag

A bugsnag wrapper for paperplane.

npm version npm downloads Build Status Coverage Status

Filters `Boom` client errors (4xx) and `Joi` validation errors, and adds request data to the error notification for debugging.

Usage

Setup your bugsnag like this:

// server/lib/bugsnag.js

const bugsnag = require('bugsnag')

const bugsnagClient = bugsnag({
  apiKey: process.env.BUGSNAG_API_KEY,
  notifyReleaseStages: ['prod', 'stage'],
  releaseStage: process.env.SERVICE_ENV
})

module.exports = require('paperplane-bugsnag')(bugsnagClient)

Then use it as the cry option in paperplane like this:

// server/index.js

const http = require('http')
const { mount } = require('paperplane')

const app = require('./rest')
const cry = require('./lib/bugsnag').notify

http.createServer(mount({ app, cry })).listen(3000, cry)

Keywords