Skip to content

Commit 7a2ca0a

Browse files
committed
Revert "chore: remove try catch"
This reverts commit 862be23.
1 parent 862be23 commit 7a2ca0a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

pages/api/test4.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ import * as Sentry from '@sentry/nextjs'
22

33
async function handler(req, res) {
44
try {
5-
throw new Error('API Test 4')
6-
} catch (error) {
7-
Sentry.captureException(error)
5+
try {
6+
throw new Error('API Test 4')
7+
} catch (error) {
8+
Sentry.captureException(error)
9+
}
10+
11+
// Flushing before returning is necessary if deploying to Vercel, see
12+
// https://vercel.com/docs/platform/limits#streaming-responses
13+
await Sentry.flush(2000)
14+
} catch (err) {
15+
console.log(err)
816
}
9-
10-
// Flushing before returning is necessary if deploying to Vercel, see
11-
// https://vercel.com/docs/platform/limits#streaming-responses
12-
await Sentry.flush(2000)
1317
res.status(200).json({ name: 'John Doe' })
1418
}
1519

0 commit comments

Comments
 (0)