onError method

Result<T> onError(
  1. void action(
    1. Failure failure
    )
)

Invokes action with the failure if this is an Error. Returns this for chaining.

Implementation

Result<T> onError(void Function(Failure failure) action) {
  if (this case Error<T>(:final failure)) action(failure);
  return this;
}