captureSafely method
Future<void>
captureSafely(
- BaseException exception, {
- Map<
String, dynamic> additionalContext = const {}, - bool manual = false,
- bool handled = true,
Captures and reports exception without ever throwing.
This is the reporting path used by guard/guardSync,
BugReportBindings, and ErrorBoundary: it is a no-op before
initialize, and any failure in context collection, sanitization, or
delivery is swallowed so reporting can never change the outcome of the
code being reported on. Prefer this for any fire-and-forget reporting;
use capture only when you want delivery failures surfaced to you.
Implementation
Future<void> captureSafely(
BaseException exception, {
Map<String, dynamic> additionalContext = const {},
bool manual = false,
bool handled = true,
}) async {
if (!isInitialized) return;
try {
await capture(
exception,
additionalContext: additionalContext,
manual: manual,
handled: handled,
);
} catch (_) {
// Intentionally ignored: reporting failures must never crash the app.
}
}