Add an Express error handler to capture errors to Sentry.
The error handler must be before any other middleware and after all controllers.
The Express instances
Optional
{ExpressHandlerOptions} Configuration options for the handler
const Sentry = require('@sentry/node');const express = require("express");const app = express();// Add your routes, etc.// Add this after all routes,// but before any and other error-handling middlewares are definedSentry.setupExpressErrorHandler(app);app.listen(3000); Copy
const Sentry = require('@sentry/node');const express = require("express");const app = express();// Add your routes, etc.// Add this after all routes,// but before any and other error-handling middlewares are definedSentry.setupExpressErrorHandler(app);app.listen(3000);
Add an Express error handler to capture errors to Sentry.
The error handler must be before any other middleware and after all controllers.