File size: 418 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import fs from 'fs'
import path from 'path'

export const revalidate = 3

export default async function Page() {
  const shouldError = (
    await fs.promises.readFile(
      path.join(process.cwd(), 'app/isr-error-handling/error.txt'),
      'utf8'
    )
  ).trim()

  if (shouldError === 'yes') {
    throw new Error('intentional error')
  }

  return (
    <div>
      <p id="now">{Date.now()}</p>
    </div>
  )
}