catchError<Error extends DomainException, Success> method
Success?
catchError<Error extends DomainException, Success>(
- Either<
Error, Success?> result, [ - void success(
- Success success
Unwraps the error and guides it to the errorProvider after converting Data to Domain errors
Implementation
@protected
Success? catchError<Error extends DomainException, Success>(
Either<Error, Success?> result, [
void Function(Success success)? success,
]) {
return result.fold(
(e) {
setError(e);
return null;
},
(e) {
if (e != null) {
success?.call(e);
}
return e;
},
);
}