Mercurial > pub > ImplabNet
diff Implab/Safe.cs @ 94:a43745f81f10 v2
minor fixes
author | cin |
---|---|
date | Thu, 23 Oct 2014 17:50:09 +0400 |
parents | efcb076407a7 |
children | 0141a165d032 |
line wrap: on
line diff
--- a/Implab/Safe.cs Thu Oct 23 01:13:57 2014 +0400 +++ b/Implab/Safe.cs Thu Oct 23 17:50:09 2014 +0400 @@ -44,7 +44,7 @@ } [DebuggerStepThrough] - public static IPromise<T> GuargPromise<T>(Func<T> action) { + public static IPromise<T> InvokePromise<T>(Func<T> action) { ArgumentNotNull(action, "action"); var p = new Promise<T>(); @@ -58,11 +58,11 @@ } [DebuggerStepThrough] - public static IPromise<T> GuardPromise<T>(Func<IPromise<T>> action) { + public static IPromise<T> InvokePromise<T>(Func<IPromise<T>> action) { ArgumentNotNull(action, "action"); try { - return action(); + return action() ?? Promise<T>.ExceptionToPromise(new Exception("The action returned null")); } catch (Exception err) { return Promise<T>.ExceptionToPromise(err); }