ResTDoIfErr Method

Runs actionOnErr() only if IsErr; and returns itself back. Counterpart of Do(ActionT) for the Err variant.
C#
// the logging call will only be made if the result of TryGetUser is Err.
// Since DoIfErr returns back the result, it can still be assigned to var 'user'.
Res<User> user = TryGetUser().DoIfErr(err => Log.Warning($"User could not be read. {err}"));

Definition

Namespace: Orx.Fun.Result
Assembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
C#
public Res<T> DoIfErr(
	Action<string> actionOnErr
)

Parameters

actionOnErr  ActionString
Action that will be called when Err.

Return Value

ResT

See Also