6.1.0 • Published 7 years ago

hapi-raven-boom v6.1.0

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
7 years ago

hapi-raven-boom Build Status

A Hapi plugin for sending exceptions to Sentry.io through Raven.

This is a fork of @bendrucker's hapi-raven@5.0.0 package that also captures Boom responses automatically.

Requirements

The plugin is written in ES2016, please use Node.js v4 or later.

Installation

Add hapi-raven-boom as a dependency to your project:

$ npm i -S hapi-raven-boom

Usage

const Hapi = require('hapi');
const Server = new Hapi.Server();
Server.connection();

Server.register({
    register: require('hapi-raven-boom'),
    options: {
        dsn: process.env.SENTRY_DSN,
        settings: {
            captureUnhandledRejections: true
        },
        tags: ['some-tag']
    },
}, (err) => {

    if (err) {
        return console.error(err);
    }
    
    Server.start(() => {
    
        console.info(`Server started at ${ Server.info.uri }`);
    });
});

Options

Manually using the Raven client

For convenience, the Raven client is exposed through server.plugins['hapi-raven-boom'].client. This will allow you to capture additional events, set the context and more.