GuardedRun
Static class in Oadm.Sdk.Client · Oadm.Sdk.Client.dll
A server call of a page or dialog that must never crash it: whatever goes wrong comes back as the text to show (ServerErrors.Message: the server’s reason, else the exception’s message).
public static class GuardedRunMethods
Section titled “Methods”RunAsync
Section titled “RunAsync”static Task<string?> RunAsync(Func<Task> work, GuardedCancel cancel = Report, CancellationToken? ct = null)Runs work on the caller’s context. Null when it ended, else the text of what went wrong.
Parameters
work: The call, with everything that belongs to it.cancel: What a cancellation is: a failure with a text (the default), nothing, or an exception that leaves the run.ct: WithGuardedCancel.IgnoreorGuardedCancel.Throw: whatever the call throws while this token is cancelled counts as the cancellation, a cancellation at any other time is a failure with a text. Null: every cancellation counts, also a server call that was cancelled.