public static class ReactiveBridgeExceptionExtensions Observes IHandleObservableErrors.ThrownExceptions of ReactiveUI commands and objects yourself, instead of the logging that a generated Bridge gives each bridged command.
Remarks
A ReactiveCommand reports every exception on ThrownExceptions, including a declared RunicFailureException that the Bridge already delivered to the client as domain-failed. While a generated Bridge presents a ViewModel, it observes each bridged command's ThrownExceptions and logs an unexpected exception that no Bridge call reported, as ReactiveCommandFailed (event 1042), through the Window's logger factory. Use this helper to handle a command's exceptions yourself: while it observes a command, the Bridge does not log that command's exceptions. Without any subscriber, ReactiveUI sends them to RxState.DefaultExceptionHandler.
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, and a generated Bridge that presents source does not log its exceptions: this handler replaces that logging. 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.
Remarks
While subscribed, a generated Bridge that presents source does not log its exceptions.