Mercurial > pub > ImplabJs
diff src/implab/safe.js @ 33:8af8e840dd49
added return fn
author | nickolay |
---|---|
date | Wed, 05 Jun 2019 17:44:17 +0300 |
parents | 8332e287d552 |
children |
line wrap: on
line diff
--- a/src/implab/safe.js Mon Dec 11 16:48:19 2017 +0300 +++ b/src/implab/safe.js Wed Jun 05 17:44:17 2019 +0300 @@ -164,10 +164,10 @@ if (x && x.then) return x; return { - then : function(cb) { + then: function (cb) { try { return cb ? wrapresult(cb(x)) : this; - } catch(e2) { + } catch (e2) { return wrapresult(e2); } } @@ -175,10 +175,12 @@ } } - try { - return wrapresult(fn.apply(thisArg, arguments)); - } catch (e) { - return wrapresult(null, e); + return function () { + try { + return wrapresult(fn.apply(thisArg, arguments)); + } catch (e) { + return wrapresult(null, e); + } }; },