Exception Handling
Exceptions thrown by the Event Broker
The event broker will throw an exception during registration when
- the publisher or subscriber was already registered for the event topic
- the publisher and subscriber do not match (handler restrictions, publisher event args not assignable to subscriber event args
- the event or handler method signature cannot be handled
Exceptions thrown by Subscribers
When a subscriber throws an exception while handling an event it depends on whether the handler is synchronous or asynchronous. An exception thrown by a synchronous handler is passed to the publisher. An exception of an asynchronous handler can only be catched by the global .net background thread exception handler.
You can get better control over exception throwing subscribers by implementing an
extension. All built-in handlers call
SubscriberExceptionOccurred
on all extensions. An extension can then mark the exception as handled
and the event broker won't re-throw the exception.