onFailure method

Try<SuccessT, UserException> onFailure(
  1. void action(
    1. UserException
    )
)
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;
}