Next.js Discord

Discord Forum

Sentry.captureException doesnt work

Unanswered
Channel catfish posted this in #help-forum
Open in Discord
Avatar
Channel catfishOP
My code looks like this. sentry capture exception doesnt get ran..

export default async function handler(req, res) { try { throw new Error("error") } catch (e) { errorHandler(e, res) } } import * as Sentry from "@sentry/node" export default function errorHandler(err, res) { console.error(err); if (process.env.NODE_ENV === 'production') { Sentry.captureException(err) } return res.status(500).json({ message: "Internal server error" }); }

0 Replies