mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
36 lines
720 B
JavaScript
36 lines
720 B
JavaScript
var test1, test2;
|
|
|
|
var p = new Promise(function(res,rej) {
|
|
throw "Bummer 1";
|
|
}).then(function(r) {
|
|
console.log("then");
|
|
}).catch(function(e) {
|
|
console.log("catch ",e);
|
|
test1 = 1;
|
|
});
|
|
|
|
|
|
// This should be called when 'Bummer 2' is thrown
|
|
process.on('uncaughtException', function(e) {
|
|
console.log("expected ",e);
|
|
if (e.toString().indexOf("Unhandled promise rejection")>=0)
|
|
test2 = 1;
|
|
});
|
|
|
|
var p = new Promise(function(res,rej) {
|
|
throw "Bummer 2";
|
|
}).then(function(r) {
|
|
console.log("then");
|
|
}).then(function(r) {
|
|
console.log("then");
|
|
}).then(function(r) {
|
|
console.log("then");
|
|
}).then(function(r) {
|
|
console.log("then");
|
|
});
|
|
|
|
setTimeout(function() {
|
|
result = test1 && test2;
|
|
}, 10);
|
|
|