diff Implab/PromiseT.cs @ 203:4d9830a9bbb8 v2

Added 'Fail' method to RunnableComponent which allows component to move from Running to Failed state. Added PollingComponent a timer based runnable component More tests Added FailPromise a thin class to wrap exceptions Fixed error handling in SuccessPromise classes.
author cin
date Tue, 18 Oct 2016 17:49:54 +0300
parents e03ccec4a08d
children
line wrap: on
line diff
--- a/Implab/PromiseT.cs	Tue Oct 18 01:03:49 2016 +0300
+++ b/Implab/PromiseT.cs	Tue Oct 18 17:49:54 2016 +0300
@@ -45,9 +45,7 @@
         }
 
         public static IPromise<T> FromException(Exception error) {
-            var p = new Promise<T>();
-            p.Reject(error);
-            return p;
+            return new FailedPromise<T>(error);
         }
 
         public virtual void Resolve(T value) {