onFailure method

Try<SuccessT, ResourceException> onFailure(
  1. void action(
    1. ResourceException
    )
)
inherited

Performs the given action on the encapsulated Throwable exception if this instance represents failure. Returns the original Try unchanged.

Implementation

Try<Success, Failure> onFailure(void Function(Failure) action) {
  if (isFailure) {
    action(exceptionOrNull()!);
  }
  return this;
}