catching<I, O> function
Mapping<I, O?>
catching<
I, O>( - O execute(
- I input
), {
- String? debugLabel,
- Logger? logger,
})
Implementation
Mapping<I, O?> catching<I, O>(O execute(I input),
{String? debugLabel, Logger? logger}) {
return (I input) {
try {
final result = execute(input);
if (result is Future) {
result.catchError((e, StackTrace stack) {
(logger ?? _log)
.severe((debugLabel ?? "Error catching") + ": $e", e, stack);
});
}
return result;
} catch (e, stack) {
(logger ?? _log)
.severe((debugLabel ?? "Error catching") + ": $e", e, stack);
return null;
}
};
}