コード例 #1
0
        /// <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;
            }
        }
コード例 #2
0
 public override void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context)
 {
     context.SetHandled();
 }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
 /// <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);
 }
コード例 #5
0
 public void SubscriberExceptionOccurred(IEventTopicInfo eventTopic, Exception exception, ExceptionHandlingContext context)
 {
     this.log.AppendLine("SubscriberExceptionOccured");
 }
コード例 #6
0
        /// <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;
        } 
コード例 #7
0
 /// <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)
 {
 }
コード例 #8
0
ファイル: DebugLogger.cs プロジェクト: ursenzler/eventbroker
        /// <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();
        }