Files
next.js/test/integration/custom-error-page-exception/pages/_error.js

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`
}