How to capture errors and exceptions with Sentry

Keeping track of errors in prod is essential to have a healthy app. Use Sentry to gather all your error reports in one place.

It’s really easy, just configure sentry in your app and capture the exceptions like this

import { captureException } from "@sentry/nextjs";

try {
    // ... logic
} catch (error) {
    captureException("failed creating subscription", {
      extra: { error, userId: user.id },
    });
}