ResDoIfErr(ActionString) Method

Runs action(error-message) only if IsErr; and returns itself back. This is the counterpart of the Do(Action) method.
C#
Res result = RefreshIndices(/*inputs*/).DoIfErr(err =>  Alert($"database connection failed: {err}"));
// result will be:
// - Ok if refreshing db indices succeeded;
// - Err if it failed, in which case the Alert call will be made.

Definition

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

Parameters

action  ActionString
Action to be executed only if this IsErr.

Return Value

Res

See Also