impl Sentry
Some checks failed
Deploy / deploy (push) Failing after 2m14s

This commit is contained in:
Lee
2024-09-30 09:20:48 +01:00
parent 843b2c81b6
commit f1eb855ba2
12 changed files with 1898 additions and 8 deletions

View File

@ -80,6 +80,11 @@ export async function generateMetadata(props: Props): Promise<Metadata> {
Joined ScoreSaber: ${format(player.joinedDate, { date: "medium", time: "short" })}
View the scores for ${player.name}!`,
images: [
{
url: player.avatar,
},
],
},
};
}

23
src/app/global-error.tsx Normal file
View File

@ -0,0 +1,23 @@
"use client";
import * as Sentry from "@sentry/nextjs";
import NextError from "next/error";
import { useEffect } from "react";
export default function GlobalError({ error }: { error: Error & { digest?: string } }) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);
return (
<html>
<body>
{/* `NextError` is the default Next.js error page component. Its type
definition requires a `statusCode` prop. However, since the App Router
does not expose status codes for errors, we simply pass 0 to render a
generic error message. */}
<NextError statusCode={0} />
</body>
</html>
);
}

13
src/instrumentation.ts Normal file
View File

@ -0,0 +1,13 @@
import * as Sentry from '@sentry/nextjs';
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('../sentry.server.config');
}
if (process.env.NEXT_RUNTIME === 'edge') {
await import('../sentry.edge.config');
}
}
export const onRequestError = Sentry.captureRequestError;