From 65ef101aff3da71053ae296933e86467c0704452 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Wed, 7 Dec 2016 11:22:59 -0500 Subject: [PATCH] don't log intermediate uncaught promise errors in request --- README.md | 2 +- mithril.js | 2 +- mithril.min.js | 4 ++-- request/request.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4b900337..3b577d13 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,6 @@ There are over 4000 assertions in the test suite, and tests cover even difficult ## Modularity -Despite the huge improvements in performance and modularity, the new codebase is smaller than v0.2.x, currently clocking at 7.49 KB min+gzip +Despite the huge improvements in performance and modularity, the new codebase is smaller than v0.2.x, currently clocking at 7.50 KB min+gzip In addition, Mithril is now completely modular: you can import only the modules that you need and easily integrate 3rd party modules if you wish to use a different library for routing, ajax, and even rendering diff --git a/mithril.js b/mithril.js index b190fda0..02b87bb3 100644 --- a/mithril.js +++ b/mithril.js @@ -214,7 +214,7 @@ var _8 = function($window, Promise) { var next = then0.apply(promise0, arguments) next.then(complete, function(e) { complete() - throw e + if (count === 0) throw e }) return finalize(next) } diff --git a/mithril.min.js b/mithril.min.js index ea220c93..801c1241 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -6,8 +6,8 @@ void 0)};B.fragment=function(a,c){return y("[",a.key,a,y.normalizeChildren(c),vo h(k.bind(c))}}catch(G){n(G)}}}function h(a){function b(b){return function(a){0a.indexOf("?")?"?":"&";a+=d+b}return a}function k(a){try{return""!==a?JSON.parse(a):null}catch(r){throw Error(a);}}function n(a){return a.responseText}function m(a, +"["+g+"]",d[g]);else if("[object Object]"===Object.prototype.toString.call(d))for(g in d)c(a+"["+g+"]",d[g]);else h.push(encodeURIComponent(a)+(null!=d&&""!==d?"="+encodeURIComponent(d):""))}if("[object Object]"!==Object.prototype.toString.call(a))return"";var h=[],d;for(d in a)c(d,a[d]);return h.join("&")},M=function(a,c){function h(){function b(){0===--a&&"function"===typeof t&&t()}var a=0;return function w(c){var d=c.then;c.then=function(){a++;var g=d.apply(c,arguments);g.then(b,function(c){b(); +if(0===a)throw c;});return w(g)};return c}}function d(b,a){if("string"===typeof b){var c=b;b=a||{};null==b.url&&(b.url=c)}return b}function g(b,a){if(null==a)return b;for(var c=b.match(/:[^\/]+/gi)||[],d=0;da.indexOf("?")?"?":"&";a+=d+b}return a}function k(a){try{return""!==a?JSON.parse(a):null}catch(r){throw Error(a);}}function n(a){return a.responseText}function m(a, c){if("function"===typeof a)if(c instanceof Array)for(var b=0;bz.status||304===z.status)c(m(b.type,a));else{var g=Error(z.responseText),h;for(h in a)g[h]=a[h];d(g)}}catch(F){d(F)}};h&&null!=b.data?z.send(b.data):z.send()});return!0===b.background?w:t(w)},jsonp:function(b,k){var n=h();b=d(b,k);var w=new c(function(c, diff --git a/request/request.js b/request/request.js index e813446b..2a9597ba 100644 --- a/request/request.js +++ b/request/request.js @@ -18,7 +18,7 @@ module.exports = function($window, Promise) { var next = then.apply(promise, arguments) next.then(complete, function(e) { complete() - throw e + if (count === 0) throw e }) return finalize(next) }