Skip to content

Commit

Permalink
add global client error handling per Sentry docs (#4231)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmer authored Feb 28, 2024
1 parent 5ae3cb6 commit d457db9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/app/global-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use client";

import * as Sentry from "@sentry/nextjs";
import NextError from "next/error";
import { useEffect } from "react";

export default function GlobalError({ error }) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);

return (
<html>
<body>
{/* This is the default Next.js error component. */}
<NextError />
</body>
</html>
);
}

0 comments on commit d457db9

Please sign in to comment.