@sentry/node
Version:
Sentry Node SDK using OpenTelemetry for performance instrumentation
31 lines (30 loc) • 852 B
JavaScript
import { attachKoaErrorHandler } from "@sentry/server-utils";
// src/integrations/tracing/koa.ts
/**
* Add a Koa error handler to capture errors to Sentry.
*
* @deprecated The error handler is now registered automatically when the Koa app
* starts (via the orchestrion `koa` instrumentation), so calling this is no
* longer necessary. It remains a safe, idempotent operation, and is kept for
* setups where auto-registration is unavailable. This will be removed in a
* future major version.
*
* @param app The Koa app instance
*
* @example
* ```javascript
* const Sentry = require('@sentry/node');
* const Koa = require("koa");
*
* const app = new Koa();
*
* // Add your routes, etc.
*
* app.listen(3000);
* ```
*/
const setupKoaErrorHandler = (app) => {
attachKoaErrorHandler(app);
};
export { setupKoaErrorHandler };
//# sourceMappingURL=koa.js.map