diff --git a/packages/node/src/integrations/tracing/express.ts b/packages/node/src/integrations/tracing/express.ts index 773dca32930a..b8c50e0eb621 100644 --- a/packages/node/src/integrations/tracing/express.ts +++ b/packages/node/src/integrations/tracing/express.ts @@ -83,16 +83,18 @@ type ExpressMiddleware = ( next: (error: MiddlewareError) => void, ) => void; -/** - * An Express-compatible error handler. - */ -export function expressErrorHandler(options?: { +interface ExpressHandlerOptions { /** * Callback method deciding whether error should be captured and sent to Sentry * @param error Captured middleware error */ shouldHandleError?(this: void, error: MiddlewareError): boolean; -}): ExpressMiddleware { +} + +/** + * An Express-compatible error handler. + */ +export function expressErrorHandler(options?: ExpressHandlerOptions): ExpressMiddleware { return function sentryErrorMiddleware( error: MiddlewareError, _req: http.IncomingMessage, @@ -137,7 +139,7 @@ export function expressErrorHandler(options?: { */ export function setupExpressErrorHandler( app: { use: (middleware: ExpressMiddleware) => unknown }, - options?: Parameters[0], + options?: ExpressHandlerOptions, ): void { app.use(expressErrorHandler(options)); ensureIsWrapped(app.use, 'express');