errors 0.1.1
errors: ^0.1.1 copied to clipboard

Dart native js
Flutter Android iOS Linux macOS web Windows

Multi exception handler

errors #

Errors keeps a registry of all possible exceptions which could be encountered.

Many times several exceptions can occur, some common and some less common.

In order to handle these gracefully we will often want to react differently according to the nature of the error.

e.g. code might fail due to a http error and within the same block a disk could be full or even a legitimate user error could be thrown.

Quick example:

  Errors errors;
  SomeExceptionHandler someExceptionHandler = SomeExceptionHandler();
  AnotherExceptionHandler anotherExceptionHandler = AnotherExceptionHandler();
  final errors = Errors()
  // Instead of using try/catch blocks the exceptions are now 
  // automatically catched and the registered exception handlers will
  // handle the exceptions.
    () {
      throw SomeException();

    () {
      throw AnotherException();