don't log intermediate uncaught promise errors in request
This commit is contained in:
parent
04b860cefc
commit
65ef101aff
4 changed files with 5 additions and 5 deletions
|
|
@ -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 <!-- size -->7.49 KB<!-- /size --> min+gzip
|
||||
Despite the huge improvements in performance and modularity, the new codebase is smaller than v0.2.x, currently clocking at <!-- size -->7.50 KB<!-- /size --> 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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
4
mithril.min.js
vendored
4
mithril.min.js
vendored
|
|
@ -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){0<c++||b(a)}}var c=0,d=b(n);try{a(b(k),d)}catch(w){d(w)}}if(!(this instanceof x))throw Error("Promise must be called with `new`");if("function"!==typeof a)throw new TypeError("executor must be a function");var d=this,g=[],l=[],k=c(g,!0),n=c(l,!1),m=d._instance={resolvers:g,rejectors:l},p="function"===typeof setImmediate?setImmediate:setTimeout;h(a)};x.prototype.then=function(a,c){function h(a,c,h,k){c.push(function(b){if("function"!==
|
||||
typeof a)h(b);else try{g(a(b))}catch(r){l&&l(r)}});"function"===typeof d.retry&&k===d.state&&d.retry()}var d=this._instance,g,l,k=new x(function(a,c){g=a;l=c});h(a,d.resolvers,g,!0);h(c,d.rejectors,l,!1);return k};x.prototype["catch"]=function(a){return this.then(null,a)};x.resolve=function(a){return a instanceof x?a:new x(function(c){c(a)})};x.reject=function(a){return new x(function(c,h){h(a)})};x.all=function(a){return new x(function(c,h){var d=a.length,g=0,l=[];if(0===a.length)c([]);else for(var k=
|
||||
0;k<a.length;k++)(function(k){function m(a){g++;l[k]=a;g===d&&c(l)}null==a[k]||"object"!==typeof a[k]&&"function"!==typeof a[k]||"function"!==typeof a[k].then?m(a[k]):a[k].then(m,h)})(k)})};x.race=function(a){return new x(function(c,h){for(var d=0;d<a.length;d++)a[d].then(c,h)})};"undefined"===typeof E&&("undefined"!==typeof window?window.Promise=x:"undefined"!==typeof global&&(global.Promise=x));var H="undefined"!==typeof E?E:x,I=function(a){function c(a,d){if(d instanceof Array)for(var g=0;g<d.length;g++)c(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(a){b();
|
||||
throw a;});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;d<c.length;d++){var g=c[d].slice(1);null!=a[g]&&(b=b.replace(c[d],a[g]),delete a[g])}return b}function l(a,c){var b=I(c);if(""!==b){var d=0>a.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;d<c.length;d++){var g=c[d].slice(1);null!=a[g]&&(b=b.replace(c[d],a[g]),delete a[g])}return b}function l(a,c){var b=I(c);if(""!==b){var d=0>a.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;b<c.length;b++)c[b]=new a(c[b]);else return new a(c);return c}var p=0,t;return{request:function(b,p){var t=h();b=d(b,p);var w=new c(function(c,d){null==b.method&&(b.method="GET");b.method=b.method.toUpperCase();var h="boolean"===typeof b.useBody?b.useBody:"GET"!==b.method&&"TRACE"!==b.method;"function"!==typeof b.serialize&&(b.serialize="undefined"!==typeof FormData&&b.data instanceof FormData?function(a){return a}:JSON.stringify);"function"!==
|
||||
typeof b.deserialize&&(b.deserialize=k);"function"!==typeof b.extract&&(b.extract=n);b.url=g(b.url,b.data);h?b.data=b.serialize(b.data):b.url=l(b.url,b.data);var z=new a.XMLHttpRequest;z.open(b.method,b.url,"boolean"===typeof b.async?b.async:!0,"string"===typeof b.user?b.user:void 0,"string"===typeof b.password?b.password:void 0);b.serialize===JSON.stringify&&h&&z.setRequestHeader("Content-Type","application/json; charset=utf-8");b.deserialize===k&&z.setRequestHeader("Accept","application/json, text/*");
|
||||
b.withCredentials&&(z.withCredentials=b.withCredentials);"function"===typeof b.config&&(z=b.config(z,b)||z);z.onreadystatechange=function(){if(4===z.readyState)try{var a=b.extract!==n?b.extract(z,b):b.deserialize(b.extract(z,b));if(200<=z.status&&300>z.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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue