diff Implab/AbstractEvent.cs @ 190:1c2a16d071a7 v2

Слияние с ref20160224
author cin
date Fri, 22 Apr 2016 13:08:08 +0300
parents 75103928da09
children d6fe09f5592c
line wrap: on
line diff
--- a/Implab/AbstractEvent.cs	Fri Feb 19 18:07:17 2016 +0300
+++ b/Implab/AbstractEvent.cs	Fri Apr 22 13:08:08 2016 +0300
@@ -78,13 +78,9 @@
         /// <exception cref="InvalidOperationException">Данное обещание уже выполнено</exception>
         protected void SetError(Exception error) {
             if (BeginTransit()) {
-                if (error is OperationCanceledException) {
-                    m_error = error.InnerException;
-                    CompleteTransit(CANCELLED_STATE);
-                } else {
-                    m_error = error is PromiseTransientException ? error.InnerException : error;
-                    CompleteTransit(REJECTED_STATE);
-                }
+                m_error = error;
+                CompleteTransit(REJECTED_STATE);
+
                 Signal();
             } else {
                 WaitTransition();
@@ -139,11 +135,11 @@
                 case SUCCEEDED_STATE:
                     return;
                 case CANCELLED_STATE:
-                    throw new OperationCanceledException();
+                    throw new OperationCanceledException("The operation has been cancelled", m_error);
                 case REJECTED_STATE:
                     throw new TargetInvocationException(m_error);
                 default:
-                    throw new ApplicationException(String.Format("Invalid promise state {0}", m_state));
+                    throw new ApplicationException(String.Format("The promise state {0} is invalid", m_state));
             }
         }
         #endregion