mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
12 lines
268 B
JavaScript
12 lines
268 B
JavaScript
let renderCount = 0
|
|
|
|
export default function Error() {
|
|
renderCount++
|
|
|
|
// Guard to avoid endless loop crashing the browser tab.
|
|
if (typeof window !== 'undefined' && renderCount < 3) {
|
|
throw new Error('crash')
|
|
}
|
|
return `error threw ${renderCount} times`
|
|
}
|