# HG changeset patch # User cin # Date 1423296402 -10800 # Node ID b5c2d609d71b8c8249a08efad52cf292b295a399 # Parent 671f60cd0250319594901aa43a488dd8a70dba60 minor changes diff -r 671f60cd0250 -r b5c2d609d71b Implab/Safe.cs --- 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 action) { + ArgumentNotNull(action, "action"); + + var p = new Promise(); + try { + action(); + p.Resolve(); + } catch (Exception err) { + p.Reject(err); + } + + return p; + } + + [DebuggerStepThrough] public static IPromise InvokePromise(Func> action) { ArgumentNotNull(action, "action");