6.3.1 • Published 1 year ago

@financial-times/n-raven v6.3.1

Weekly downloads
2,385
License
MIT
Repository
github
Last release
1 year ago

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.

6.3.1

1 year ago

6.3.0

2 years ago

6.2.0

2 years ago

6.1.0

2 years ago

6.0.0

2 years ago

5.0.2

2 years ago

5.0.1

3 years ago

5.0.0

4 years ago

4.0.0

4 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

7 years ago

3.0.0-beta.2

7 years ago

3.0.0-beta.1

7 years ago

2.2.4

7 years ago

2.2.3

7 years ago

2.1.0

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago