presenton/electron/servers/nextjs/app/api/sentry-example-api/route.ts
sudipnext b1e3d826dd feat: integrate Sentry for error tracking in Next.js application
- Added @sentry/nextjs dependency to package.json
- Created sentry.edge.config.ts for edge feature initialization
- Created sentry.server.config.ts for server-side initialization
- Configured Sentry with DSN, tracesSampleRate, logs, and PII settings
2026-04-03 14:22:36 +05:45

17 lines
484 B
TypeScript

import * as Sentry from "@sentry/nextjs";
export const dynamic = "force-dynamic";
class SentryExampleAPIError extends Error {
constructor(message: string | undefined) {
super(message);
this.name = "SentryExampleAPIError";
}
}
// A faulty API route to test Sentry's error monitoring
export function GET() {
Sentry.logger.info("Sentry example API called");
throw new SentryExampleAPIError(
"This error is raised on the backend called by the example page.",
);
}