Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f691362

Browse files
committedMar 1, 2023
fix: error handling in revalidate api function
1 parent 98407ea commit f691362

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎demos/default/pages/api/revalidate.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
export default async function handler(req, res) {
22
try {
3-
await res.revalidate('/getStaticProps/with-revalidate/')
4-
console.log('Revalidated', req.url)
3+
const path = '/getStaticProps/with-revalidate/'
4+
await res.revalidate(path)
5+
console.log('Revalidated:', path)
56
return res.json({ revalidated: true })
67
} catch (err) {
7-
return res.status(500).send('Error revalidating')
8+
return res.status(500).send('Error revalidating:', err)
89
}
910
}

0 commit comments

Comments
 (0)
Please sign in to comment.