hapi-raven-boom

6.1.0 • Public • Published

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

  • dsn - [REQUIRED] - Sentry DSN for the project.
  • settings - [OPTIONAL] - An object with extra settings for the Sentry client. See sentry configuration notes
  • tags - [OPTIONAL] - An array of tags (strings) to apply to each captured event.

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.

Package Sidebar

Install

npm i hapi-raven-boom

Weekly Downloads

1

Version

6.1.0

License

BSD-3-Clause

Last publish

Collaborators

  • antonsamper