# HG changeset patch # User cin # Date 2014-11-10 07:17:54 # Node ID 4d308952fd5ed59a8bec6d8fdf90caadf2d5cfdc # Parent 5f10d54b45df84453df834a81adff27a022bc8d6 minor fixes diff --git a/Implab.Test/AsyncTests.cs b/Implab.Test/AsyncTests.cs --- a/Implab.Test/AsyncTests.cs +++ b/Implab.Test/AsyncTests.cs @@ -139,6 +139,21 @@ namespace Implab.Test { } [TestMethod] + public void ChainFailTest() { + var p1 = new Promise(); + + var p3 = p1.Chain(x => { + var p2 = new Promise(); + p2.Reject(new Exception("DIE!!!")); + return p2; + }); + + p1.Resolve(100); + + Assert.IsTrue(p3.IsResolved); + } + + [TestMethod] public void PoolTest() { var pid = Thread.CurrentThread.ManagedThreadId; var p = AsyncPool.Invoke(() => Thread.CurrentThread.ManagedThreadId); diff --git a/Implab/Promise.cs b/Implab/Promise.cs --- a/Implab/Promise.cs +++ b/Implab/Promise.cs @@ -893,7 +893,7 @@ namespace Implab { void IPromise.On(Action success, Action error, Action cancel) { - On(x => success(), error, cancel); + On(success != null ? new Action(x => success()) : null, error, cancel); } void IPromise.On(Action success, Action error) {