global-error.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. 'use client';
  2. /**
  3. * Root-layout error boundary. This replaces the whole document (the root
  4. * layout failed), so globals.css + fonts are NOT available — styles are
  5. * inlined so the fallback always renders. Only triggers on catastrophic
  6. * root-level errors; segment errors use error.tsx.
  7. */
  8. export default function GlobalError({
  9. error,
  10. reset,
  11. }: {
  12. error: Error & { digest?: string };
  13. reset: () => void;
  14. }) {
  15. return (
  16. <html lang="en">
  17. <body
  18. style={{
  19. margin: 0,
  20. minHeight: '100dvh',
  21. display: 'flex',
  22. flexDirection: 'column',
  23. alignItems: 'center',
  24. justifyContent: 'center',
  25. gap: '1rem',
  26. background: '#0a0b0d',
  27. color: '#e6e6e6',
  28. fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
  29. fontSize: '14px',
  30. padding: '2rem',
  31. textAlign: 'center',
  32. }}
  33. >
  34. <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
  35. <img src="/icon.svg" alt="" width={28} height={28} />
  36. <span>briven</span>
  37. </div>
  38. <h1 style={{ fontSize: '1.5rem', margin: 0, letterSpacing: '-0.02em' }}>
  39. something broke
  40. </h1>
  41. <p style={{ color: '#9a9a9a', margin: 0, maxWidth: '32rem' }}>
  42. briven hit an unexpected error. it&apos;s been logged. try reloading.
  43. </p>
  44. {error.digest ? (
  45. <p style={{ color: '#6a6a6a', margin: 0, fontSize: '10px' }}>reference: {error.digest}</p>
  46. ) : null}
  47. <button
  48. type="button"
  49. onClick={reset}
  50. style={{
  51. marginTop: '0.5rem',
  52. border: '1px solid #2a2c31',
  53. background: '#15171a',
  54. color: '#e6e6e6',
  55. borderRadius: '6px',
  56. padding: '0.75rem 1rem',
  57. cursor: 'pointer',
  58. fontFamily: 'inherit',
  59. fontSize: '14px',
  60. }}
  61. >
  62. ↻ reload
  63. </button>
  64. <footer style={{ marginTop: '2rem', fontSize: '10px', color: '#6a6a6a' }}>
  65. built with <span style={{ color: '#e8344a' }}>♥</span> in Flanders · flndrn Limited
  66. </footer>
  67. </body>
  68. </html>
  69. );
  70. }