ResDoIfErr Method

Overload List

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

See Also