public static class RunicReactiveExceptions Observes IHandleObservableErrors.ThrownExceptions of bridged ReactiveUI commands.
Remarks
A ReactiveCommand reports every exception on ThrownExceptions, including a declared RunicFailureException that the Bridge already delivered to the client as domain-failed. Without a subscriber ReactiveUI sends it to RxState.DefaultExceptionHandler, which breaks into the debugger and throws UnhandledErrorException. Give every bridged command a subscriber: this helper or the application's own.
Methods
ObserveBridgeExceptions
public static IDisposable ObserveBridgeExceptions(this IHandleObservableErrors source, Action<Exception> onUnexpected) Subscribes to source's ThrownExceptions. A declared failure (RunicFailureException) and a cancellation (OperationCanceledException), which the Bridge already reported to the client, are ignored; any other exception goes to onUnexpected. Dispose the result to stop observing.
Remarks
While subscribed, no exception of source reaches ReactiveUI's default handler. An exception thrown by onUnexpected surfaces from ThrownExceptions.OnNext.
ObserveBridgeExceptions
public static IDisposable ObserveBridgeExceptions(this IHandleObservableErrors source, ILogger logger, string? sourceName = null) Subscribes to source's ThrownExceptions. A declared failure (RunicFailureException) and a cancellation are ignored; any other exception is logged at Error as ReactiveCommandFailed (event 1042) with sourceName as Source. Dispose the result to stop observing.
Parameters
sourceThe command or reactive object.
loggerThe logger that receives unexpected exceptions.
sourceNameThe name logged as
Source; defaults to thesourceexpression, such asSaveCommand.