Skip to content

Commit 1f20694

Browse files
authored
chore: Add dynamic import and trigger captureException (#15583)
1 parent 95a58dd commit 1f20694

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/lib/server/defaultResponder.ts

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export function defaultResponder<T>(f: Handle<T>) {
1919
} catch (err) {
2020
console.error(err);
2121
const error = getServerErrorFromUnknown(err);
22+
// dynamic import of Sentry so it's only loaded when something goes wrong.
23+
const captureException = (await import("@sentry/nextjs")).captureException;
24+
captureException(err);
25+
// return API route response
2226
return res
2327
.status(error.statusCode)
2428
.json({ message: error.message, url: error.url, method: error.method });

0 commit comments

Comments
 (0)