-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy patherror.tsx
More file actions
53 lines (47 loc) · 1.24 KB
/
error.tsx
File metadata and controls
53 lines (47 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use client';
import { useEffect } from 'react';
import Link from 'next/link';
import { ROUTES } from '@/lib/constants';
import styles from './error.module.css';
export default function MovieDetailsError({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
console.error('Movie details error:', error);
}, [error]);
return (
<div className={styles.container}>
<div className={styles.errorCard}>
<h1 className={styles.title}>
Something went wrong!
</h1>
<p className={styles.description}>
We encountered an error while loading the movie details.
</p>
<div className={styles.buttonContainer}>
<button
onClick={reset}
className={styles.retryButton}
>
Try Again
</button>
<Link
href={ROUTES.movies}
className={styles.backLink}
>
Back to Movies
</Link>
</div>
{process.env.NODE_ENV === 'development' && error.digest && (
<p className={styles.errorId}>
Error ID: {error.digest}
</p>
)}
</div>
</div>
);
}