tool_errors 0.0.6 copy "tool_errors: ^0.0.6" to clipboard
tool_errors: ^0.0.6 copied to clipboard

PlatformAndroid

Contains common arch components

tool_errors #

Error handling and crash reporting infrastructure for the application.

Overview #

Provides centralized error handling with:

  • Error handler providers for modules
  • Crash reporting (Firebase, Web)
  • Application runner with error zones
  • Logging integration

Core Concepts #

ErrorHandlerProvider #

Interface for module-specific error handlers:

abstract class ErrorHandlerProvider {
  ErrorInfo? getError(Object error, [StackTrace? stacktrace]);
}

Each module implements this to handle domain-specific errors.

ErrorsManager #

Aggregates all ErrorHandlerProvider instances and routes errors to the appropriate handler.

AppRunner #

Wraps the application in error zones and configures crash reporting:

await appRunner.run(
  appBuilder: () => MyApp(),
  firebaseCrashReports: true,
);

Usage in Modules #

Modules provide error handlers during DI setup:

// In module DI
getIt.registerFactory<ChatErrorHandlerProvider>(
  () => ChatErrorHandlerProvider(
    localeProvider: getIt.get(),
    errorCodeMapper: params.errorCodeMapper,
  ),
);

See Error Code Mapper pattern for module-specific error handling.

Integration #

ErrorsManager automatically collects all ErrorHandlerProvider implementations from GetIt and routes errors appropriately.