/// <summary> /// Handles a subscriber method exception by passing it to all extensions and re-throwing the inner exception in case that none of the /// extensions handled it. /// </summary> /// <param name="targetInvocationException">The targetInvocationException.</param> /// <param name="eventTopic">The event topic.</param> protected void HandleSubscriberMethodException(TargetInvocationException targetInvocationException, IEventTopicInfo eventTopic) { Ensure.ArgumentNotNull(targetInvocationException, "targetInvocationException"); var innerException = targetInvocationException.InnerException; innerException.PreserveStackTrace(); var context = new ExceptionHandlingContext(); this.ExtensionHost.ForEach(extension => extension.SubscriberExceptionOccurred(eventTopic, innerException, context)); if (!context.Handled) { throw innerException; } }
public override void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context) { context.SetHandled(); }
/// <summary> /// Called when an exception occurred during event handling by a subscriber. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="exception">The exception.</param> /// <param name="context">The context providing information whether the exception is handled by an extension or is re-thrown.</param> public override void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context) { Console.WriteLine( "An exception was thrown during handling the topic '{0}': {1}", eventTopic.Uri, exception); }
/// <summary> /// Called when an exception occurred during event handling by a subscriber. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="exception">The exception.</param> /// <param name="context">The context providing information whether the exception is handled by an extension or is re-thrown.</param> public override void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context) { this.log.Error( string.Format(CultureInfo.InvariantCulture, "An exception was thrown during handling the topic '{0}'", eventTopic.Uri), exception); }
public void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context) { this.log.AppendLine("SubscriberExceptionOccured"); }
/// <summary> /// Called when an exception occurred during event handling by a subscriber. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="exception">The exception.</param> /// <param name="context">The context providing information whether the exception is handled by an extension or is re-thrown.</param> public override void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context) { Debug.WriteLine( "An exception was thrown during handling the topic '{0}': {1}", eventTopic.Uri, exception); exception.PreserveStackTrace(); throw exception; }
/// <summary> /// Called when an exception occurred during event handling by a subscriber. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="exception">The exception.</param> /// <param name="context">The context providing information whether the exception is handled by an extension or is re-thrown.</param> public virtual void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context) { }
/// <summary> /// Called when an exception occurred during event handling by a subscriber. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="exception">The exception.</param> /// <param name="context">The context providing information whether the exception is handled by an extension or is re-thrown.</param> public override void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context) { Debug.WriteLine( "An exception was thrown during handling the topic '{0}': {1}", eventTopic.Uri, exception); var exceptionDispatchInfo = ExceptionDispatchInfo.Capture(exception); exceptionDispatchInfo.Throw(); }