ba00fd9f55
- @sentry/nextjs installed and configured for client, server, and edge - Instrumentation hook registers Sentry on Node.js and edge runtimes - Global error boundary captures unhandled errors to Sentry - next.config.ts wrapped with withSentryConfig (source maps disabled) - No-op when NEXT_PUBLIC_SENTRY_DSN is not set To enable: set NEXT_PUBLIC_SENTRY_DSN in .env.local or .env.production Co-Authored-By: claude-flow <ruv@ruv.net>
28 lines
507 B
TypeScript
28 lines
507 B
TypeScript
"use client";
|
|
|
|
import * as Sentry from "@sentry/nextjs";
|
|
import { useEffect } from "react";
|
|
|
|
export default function GlobalError({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error;
|
|
reset: () => void;
|
|
}) {
|
|
useEffect(() => {
|
|
Sentry.captureException(error);
|
|
}, [error]);
|
|
|
|
return (
|
|
<html>
|
|
<body>
|
|
<div style={{ padding: "2rem", textAlign: "center" }}>
|
|
<h2>Something went wrong</h2>
|
|
<button onClick={reset}>Try again</button>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|