Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 791 Bytes

README.md

File metadata and controls

30 lines (21 loc) · 791 Bytes

Middy Sentry Error Middleware

This is a middy middleware, which is reporting errors to Sentry. Http errors are not reported.

Installation

npm install @joblocal/middy-sentry-error-handler

Usage

# handler.js
const middy = require('middy');
const sentryErrorHandler = require('@joblocal/middy-sentry-error-handler');

const yourHandler = () => {
  throw new Error('this will be reported to sentry');
};

const handler = middy(yourHandler)
  .use(sentryErrorHandler({
    dsn: 'https://[email protected]/283203',
  }));

module.exports = { handler };

The options you are passing correspond to the Sentry init options.