mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Co-authored-by: Tobias Koppers <[email protected]> Co-authored-by: Tim Neutkens <[email protected]>
13 lines
321 B
JavaScript
13 lines
321 B
JavaScript
/* eslint-disable no-unused-expressions, no-undef */
|
|
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`
|
|
}
|