error_filters library

Classes

ErrorFilter
Instead of the current parameter catchAlways commands can get an optional parameter errorFilter of type ErrorFilter which can be used to customize the error handling. Additionally there will be a Global error Filter that is used if no local error filter is present.
ErrorFilterExcemption<T>
ErrorHandlerGlobalIfNoLocal
ErrorHandlerLocal
ErrorHandlerLocalAndGlobal
PredicatesErrorFilter
Takes a list of predicate functions and returns the first non null ErrorReaction or ErrorReaction.defaultHandler if no predicate matches. The predicates are called in the order of the list. which means if you want to match against a type hierarchy you have to put the more specific type first. You can define your own predicates or use the errorFilter function like this
TableErrorFilter
This filter allows to pass a table of error types and the corresponding ErrorReactions. Attention, the table can only compare the runtime type of the error on equality, not the type hierarchy. Normally you couldn't match against the Excpeption type, because the runtime type of an exception is always _Exception which is a private type. As Exception is such a basic error type this funcion has a workaround for this case. I recommend to use the PredicatesErrorFilter instead unless you have a very specific use case that requires to compare for type equality.

Functions

errorFilter<TError>(Object error, ErrorReaction reaction) ErrorReaction?

Typedefs

ErrorFilterPredicate = ErrorReaction? Function(Object error, StackTrace stackTrace)