An airbrake
wrapper for paperplane
.
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.