Calls action with the error (if any) and returns this.
action
this
Result<T> onFailure(void Function(ApiError error) action) { if (this case Failure<T>(:final error)) action(error); return this; }