Skip to main content

How can I report only manual exceptions/errors?

Issue

We want Sentry to report only the exceptions we capture manually in our code, not the errors the SDK captures automatically by default.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • Error Monitoring

  • Filtering

Resolution

Sentry has no single option to send only manually captured errors, but you can achieve this by tagging your manual events and dropping every other event in the beforeSend callback.

  1. Add a unique tag to each event you capture manually.

  2. In beforeSend, return the event only if it has that tag, and return null for everything else.

For example, in the Sentry JavaScript SDK:

Sentry.init({
dsn: "___PUBLIC_DSN___",
beforeSend(event) {
// Keep only events explicitly tagged as manual; drop the rest
if (event.tags?.manual === "true") {
return event;
}
return null;
},
});

Tag each manual capture so it passes the filter:

Sentry.captureException(error, { tags: { manual: "true" } });

The callback is named beforeSend in the JavaScript SDK and before_send in some other SDKs, such as Python. Check your SDK's filtering documentation for the exact name.

This approach drops every event that is not tagged, including automatically captured unhandled errors and crashes. Tag every event you want to keep.

Did this answer your question?