ExceptionReporter class

Central place to log or report exceptions to a third-party service.

This class provides a comprehensive exception reporting system that can:

  • Log exceptions with contextual information
  • Report to external services (Sentry, Rollbar, etc.)
  • Include user, request, and environment context
  • Support different reporting levels and filtering

The default implementation logs to the application logger, but can be extended to integrate with third-party error tracking services.

Constructors

ExceptionReporter()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

addGlobalContext(String key, dynamic value) → void
Add custom context that will be included in all future reports
clearGlobalContext() → void
Clear all custom context
configure({bool includeStackTraces = true, bool includeUserContext = true, bool includeRequestContext = true, bool includeEnvironmentInfo = true, String minimumReportLevel = 'error', Map<String, dynamic>? globalContext}) → void
Configure exception reporting settings
getConfiguration() Map<String, dynamic>
Get current configuration
removeGlobalContext(String key) → void
Remove custom context
reportAppException(AppException error, [StackTrace? stackTrace, Map<String, dynamic>? additionalContext]) → void
Report an application-specific exception with full context
reportException(Object error, [StackTrace? stackTrace, Map<String, dynamic>? additionalContext]) → void
Report a generic exception with full context
reportWithLevel(String level, Object error, [StackTrace? stackTrace, Map<String, dynamic>? additionalContext]) → void
Report an exception with custom severity level