Skip to content

articulate/paperplane-airbrake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paperplane-airbrake

An airbrake wrapper for paperplane.

npm version npm downloads Build Status Coverage Status

Usage

cry :: Airbrake -> Error -> Promise Error

Constructs a cry error-handler for paperplane to populate the airbrake notification with request details, similar to the built-in express and hapi handlers for airbrake.

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

const airbrake = Airbrake.createClient(
  process.env.AIRBRAKE_PROJECT_ID,
  process.env.AIRBRAKE_API_KEY,
  process.env.APP_ENV
)

const app = () => { throw new Error('uh oh') }

const cry = require('paperplane-airbrake')(airbrake)

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

Note: This version of paperplane-airbrake supports paperplane v2. For paperplane v1, you will need paperplane-airbrake v0.0.3. See the paperplane migration guide for more details.