Takaro - v0.6.0
    Preparing search index...

    Function setupExpressErrorHandler

    • Add an Express error handler to capture errors to Sentry.

      The error handler must be before any other middleware and after all controllers.

      Parameters

      • app: { use: (middleware: ExpressErrorMiddleware | ExpressMiddleware) => unknown }

        The Express instances

      • Optionaloptions: ExpressHandlerOptions

        {ExpressHandlerOptions} Configuration options for the handler

      Returns void

      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 defined
      Sentry.setupExpressErrorHandler(app);

      app.listen(3000);