From 1e0ad6c3d7c567cd9c0cfc5f1995e8f8cb77e288 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Mon, 22 Jun 2015 18:41:53 -0400 Subject: [PATCH] ensure we can still redraw after a promise error that gets thrown by the exception monitor --- mithril.js | 5 ++++- tests/mithril-tests.js | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mithril.js b/mithril.js index cd79c442..688112c9 100644 --- a/mithril.js +++ b/mithril.js @@ -990,7 +990,10 @@ var m = (function app(window, undefined) { } } m.deferred.onerror = function(e) { - if (type.call(e) === "[object Error]" && !e.constructor.toString().match(/ Error/)) throw e + if (type.call(e) === "[object Error]" && !e.constructor.toString().match(/ Error/)) { + pendingRequests = 0 + throw e + } }; m.sync = function(args) { diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 041b5331..7194f61a 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -3925,7 +3925,6 @@ function testMithril(mock) { var prop = m.request({method: "GET", url: "test", deserialize: function() {throw new TypeError("error occurred")}}).then(null, error) try {mock.XMLHttpRequest.$instances.pop().onreadystatechange()} catch (e) {exception = e} - m.endComputation() return prop() === undefined && error() === "no error" && exception.message == "error occurred" }) test(function() {