This package has been deprecated

Author message:

n-raven is no longer supported, you should migrate away from Sentry and use Reliability Kit’s crash handler. See the migration guide https://financialtimes.atlassian.net/l/cp/E0uWYf1y

@financial-times/n-raven

6.3.1 • Public • Published

Next Raven Circle CI

Some middleware for Express and Node that sets up Raven (or not as appropriate) depending on sensible environment variables.

This wrapper is FT.com-specific; apps maintained by teams outside of Customer Products should use @sentry/node directly.

Installation

npm install --save @financial-times/n-raven

Usage

const express = require('express');
const app = express();
const nRaven = require('@financial-times/n-raven')

const promiseEnabledApi = require('./my-promise-enabled-api');

// must come before all routes
app.use(nRaven.requestHandler);

// A typical route using Promises
app.get('/a-typical-route', async function(req, res, next) {
	try {
		const someThings = await promiseEnabledApi.getSomeThings()

		res.render(someThings);
	} catch(error) {
		// Make sure to end all async functions with a `catch`
		// that passes the error to the next middleware
		next(error);
	}
});

// must come after every route
app.use(nRaven.errorHandler);

Suppressing error logging

By default the raven error handler logs error details as well as sending error information to Sentry. You can suppress this behaviour by setting response.locals.suppressRavenLogger to true in any route before raven's error handler is registered.

Supported environment variables

  • NODE_ENV - mode to operate in, can be either PRODUCTION (sends bugs to aggregator) or any another value (shows bugs to user)
  • RAVEN_URL - URL to report bugs captured in production
  • SPLUNK_URL - URL to send non critical or upstream bugs too

License

This software is published by the Financial Times under the MIT license.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published

Package Sidebar

Install

npm i @financial-times/n-raven

Weekly Downloads

46

Version

6.3.1

License

MIT

Unpacked Size

912 kB

Total Files

32

Last publish

Collaborators

  • robertboulton
  • seraph2000
  • hamza.samih
  • notlee
  • emmalewis
  • aendra
  • the-ft
  • rowanmanning
  • chee
  • alexwilson