Skip to content

Commit

Permalink
fix: Customize error page
Browse files Browse the repository at this point in the history
  • Loading branch information
storm1729 committed Jan 3, 2024
1 parent 3a98a10 commit d554f53
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/app/global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
import * as Sentry from "@sentry/nextjs";
import Error from "next/error";
import { useEffect } from "react";
import logo from "../assets/logo/reacher-64.png";
import Image from "next/image";
import Link from "next/link";
import { Button } from "@geist-ui/react";

export default function GlobalError({
error,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
Sentry.captureException(error);
Expand All @@ -16,12 +21,18 @@ export default function GlobalError({
return (
<html>
<body>
<h2>
Something went wrong. Please email a screenshot of this page
to [email protected], thank you!
</h2>
<p>Error: {JSON.stringify(error)}</p>
<p>{error.digest}</p>
<div className="container text-center">
<Image alt="logo" src={logo} />
<h2>
Something went wrong. Please email a screenshot of this
page to [email protected], thank you!
</h2>
<p>Error: {JSON.stringify(error)}</p>
<p>{error.digest}</p>
<Link href="/">
<Button type="secondary">Go home</Button>
</Link>
</div>
</body>
</html>
);
Expand Down
6 changes: 6 additions & 0 deletions src/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ button {
* Helpers
*/

.container {
max-width: 800px;
margin-left: auto;
margin-right: auto;
}

.align-center {
align-items: center;
}
Expand Down
29 changes: 29 additions & 0 deletions src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"use client";

import { Button } from "@geist-ui/react";
import logo from "../assets/logo/reacher-512.png";
import Image from "next/image";
import Link from "next/link";

export default function NotFound() {
return (
<html>
<body>
<div
className="container text-center"
style={{ paddingTop: 200 }}
>
<Image alt="logo" src={logo} width={64} />
<h1>404</h1>
<p>
Something went wrong. Please email a screenshot of this
page to [email protected], thank you!
</p>
<Link href="/">
<Button type="secondary">Go home</Button>
</Link>
</div>
</body>
</html>
);
}

1 comment on commit d554f53

@vercel
Copy link

@vercel vercel bot commented on d554f53 Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.