Skip to content

Commit

Permalink
feat: configure error page
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmtslmngcl committed Dec 14, 2024
1 parent ab7e186 commit f7a9818
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,34 @@

import { useEffect } from 'react';

export default function Error({ error, reset }: { error: Error; reset: () => void }) {
import { CustomButton } from '@/components/Buttons/CustomButton';
import { Topbar } from '@/components/Topbar/Topbar';

export default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
useEffect(() => {
// Log the error to an error reporting service
/* eslint-disable no-console */
console.error(error);
}, [error]);

return (
<div>
<h2>Something went wrong!</h2>
<button
type="button"
onClick={
// Attempt to recover by trying to re-render the segment
() => reset()
}
>
Try again
</button>
<div className="flex flex-col h-screen">
<Topbar />
<main className="flex h-full flex-col items-center justify-center gap-2 text-content">
<section className="text-center">
<h2 className="text-xl font-semibold">An Error Occurred</h2>
<p>Please try again or go back to the Home page.</p>
</section>
<div className="flex flex-row gap-2 mt-4">
<CustomButton variant="solid" size="lg" onClick={() => reset()}>
Try again
</CustomButton>
<a href="/">
<CustomButton variant="solid" size="lg">
Go to Home page
</CustomButton>
</a>
</div>
</main>
</div>
);
}

0 comments on commit f7a9818

Please sign in to comment.