runCatching<R> method
FutureOr<R?>
runCatching<R>(
- FutureOr<
R?> block(), { - FutureOr<
R?> onSuccess(- R data
- FutureOr<
R?> onFailure(- Object e,
- StackTrace s
- bool ignoreSkipError = true,
- int slowlyMs = 0,
- Object? debounceTag,
- Object? throttleTag,
- Object? mutexTag,
override
Implementation
@visibleForTesting
@protected
@override
FutureOr<R?> runCatching<R>(
FutureOr<R?> Function() block, {
FutureOr<R?> Function(R data)? onSuccess,
FutureOr<R?> Function(Object e, StackTrace s)? onFailure,
bool ignoreSkipError = true,
int slowlyMs = 0,
Object? debounceTag,
Object? throttleTag,
Object? mutexTag,
}) => super.runCatching(
block,
onSuccess: onSuccess,
onFailure: (e, s) {
if (e is SkipError && ignoreSkipError) {
logger(
'SKIPPED: ${e.msg}',
logExtra: logExtra,
stackTrace: e.stackTrace,
);
return null;
}
final fun = onFailure ?? (e, s) => logger('$e\n$s', logExtra: logExtra);
return fun.call(e, s);
},
ignoreSkipError: false,
slowlyMs: slowlyMs,
debounceTag: debounceTag,
throttleTag: throttleTag,
mutexTag: mutexTag,
);