onFailure method
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;
}