mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## What This fixes when the deep nested routes throws a client side error, it can still be caught by the `global-error.js` ## How We should always resolve global-error from root app directory instead of current route's layout. Also fixed a bad test before where the gloabl-error.js is not located correctly Fixes #53756 Closes NEXT-1760
18 lines
371 B
JavaScript
18 lines
371 B
JavaScript
'use client'
|
|
|
|
export default function GlobalError({ error }) {
|
|
return (
|
|
<html>
|
|
<head></head>
|
|
<body>
|
|
<h1>Global Error</h1>
|
|
<p id="error">{`Global error: ${error?.message}`}</p>
|
|
{error?.digest && <p id="digest">{error?.digest}</p>}
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|
|
|
|
// for inspecting purpose
|
|
GlobalError.displayName = 'GlobalError'
|