You mean something like:
process.on("unhandledRejection", function(p, reason){
console.log('Uncaught error: ', reason); // this will get called
});
Promise.resolve().then(x => { throw "Hah"; });
function createUser(username, callback) { | |
var connection = DatabaseClient.connect(); | |
var users = connection.call('collection', 'users'); | |
var query = users.call('query', {username: username}); | |
return query.then(function(existing){ | |
if(existing) throw new Error("User already exists: " + username); | |
else return users.call('create', {username: username}); | |
}).fin(function(connection){ return connection.call('close'); }); | |
} |
You mean something like:
process.on("unhandledRejection", function(p, reason){
console.log('Uncaught error: ', reason); // this will get called
});
Promise.resolve().then(x => { throw "Hah"; });
public class EmailAddress | |
{ | |
[Match("^")] public string _; | |
[Match(@"\w+")] public string User; | |
[Match("@")] public string _1; | |
[Match("[^@]+")] public string Host; | |
[Match("$")] public string _2; | |
} | |
public static class Matcher |
we're discussing how we can safely abort on unhandled rejections and obtain meaningful debugging information. Related reading: https://gist.github.com/misterdjules/2969aa1b5e6440a7e401#file-post-mortem-debugging-with-promises-md.
In particular, we're discussing https://gist.github.com/misterdjules/2969aa1b5e6440a7e401#removing-implicit-trycatch-blocks-from-v8s-promises-implementation
Othe recommended reading: On unhandledRejection
https://gist.github.com/benjamingr/0237932cee84712951a2
return Promise.resolve().then(function rest() { | |
return Rest.webService({apiUrl: "/v4_6_release/apis/3.0/system/members", method: "GET" }).then(result => | |
(Array.isArray(result) && result.length === 0) ? "Done" : rest(); | |
}); | |
}); |
function liquidate(obj, F = Promise.getNewLibraryCopy()) { | |
const promised = F.promisifyAll({__proto__: Object.create(obj)}); | |
Object.assign(F.prototype, whenReadyAll.call(obj, promised)); // add the API | |
return promised; | |
function whenReadyAll(obj, target = {}) { | |
for(const prop in obj) target[prop] = (...args) => this.then(() => obj[prop](...args)); | |
return target; | |
} | |
} |
/* | |
* Mustache like logic less templating with reverse data binding | |
*/ | |
//HACK, do not use, EVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVER | |
//EVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVER | |
//EVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVEREVER | |
// in production code | |
//templates a given view based on the given viewmodel, for more detail on how this works please check the unit tests | |
window.Mustache = {}; |
diff --git a/benchmark/doxbee-sequential/callbacks-caolan-async-waterfall.js b/benchmark/doxbee-sequential/callbacks-caolan-async-waterfall.js | |
deleted file mode 100644 | |
index 439f9bba..00000000 | |
--- a/benchmark/doxbee-sequential/callbacks-caolan-async-waterfall.js | |
+++ /dev/null | |
@@ -1,71 +0,0 @@ | |
-require('../lib/fakes'); | |
-var async = require('async'); | |
- | |
-module.exports = function upload(stream, idOrPath, tag, done) { |
Eggs.Map = function() {} | |
, | |
Eggs.Map.init = function() { | |
function t() { | |
var t = ($(window).scrollTop() + $(window).height()) / $(document).height() * .6; | |
s.css("background-size", t * a + "px auto"), | |
s.css("background-position", 800 - o.x * t + "px " + (40 - o.y * t) + "px") | |
} | |
function e() { | |
var t = i() |