rethrow errors from other contexts

This commit is contained in:
Leo Horie 2014-08-02 21:30:15 -04:00
parent da0383cad3
commit 13967ad808

View file

@ -553,7 +553,7 @@ Mithril = m = new function app(window) {
else next[method](result !== undefined ? result : value) else next[method](result !== undefined ? result : value)
} }
catch (e) { catch (e) {
if (e instanceof Error && e.constructor !== Error) throw e if (type.call(e) == "[object Error]" && e.constructor !== Error) throw e
else next.reject(e) else next.reject(e)
} }
} }
@ -657,7 +657,7 @@ Mithril = m = new function app(window) {
} }
catch (e) { catch (e) {
if (e instanceof SyntaxError) throw new SyntaxError("Could not parse HTTP response. See http://lhorie.github.io/mithril/mithril.request.html#using-variable-data-formats") if (e instanceof SyntaxError) throw new SyntaxError("Could not parse HTTP response. See http://lhorie.github.io/mithril/mithril.request.html#using-variable-data-formats")
else if (e instanceof Error && e.constructor !== Error) throw e else if (type.call(e) == "[object Error]" && e.constructor !== Error) throw e
else deferred.reject(e) else deferred.reject(e)
} }
if (xhrOptions.background !== true) m.endComputation() if (xhrOptions.background !== true) m.endComputation()