changeset 131:b5c2d609d71b v2

minor changes
author cin
date Sat, 07 Feb 2015 11:06:42 +0300
parents 671f60cd0250
children 5fb2bbffdece
files Implab/Safe.cs
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Implab/Safe.cs	Fri Jan 30 17:07:17 2015 +0300
+++ b/Implab/Safe.cs	Sat Feb 07 11:06:42 2015 +0300
@@ -86,6 +86,21 @@
         }
 
         [DebuggerStepThrough]
+        public static IPromise InvokePromise(Func<IPromise> action) {
+            ArgumentNotNull(action, "action");
+
+            var p = new Promise();
+            try {
+                action();
+                p.Resolve();
+            } catch (Exception err) {
+                p.Reject(err);
+            }
+
+            return p;
+        }
+
+        [DebuggerStepThrough]
         public static IPromise<T> InvokePromise<T>(Func<IPromise<T>> action) {
             ArgumentNotNull(action, "action");