I've simplified the scenario in the code below because I don't have room here to explain my use case, but basically I'm throwing an error from the "catch" block of a promise. How can I get the error to get passed on from that catch block (in the example below I want the error to get reported from the outer "catch" block of the "try/catch" that I have wrapped my code with):
var p = new Promise(function(resolve, reject) {
setTimeout(function() {
reject();
}, 1000);
});
try {
p.then(function() {
console.log('promise resolved');
}).catch(function() {
throw new Error('I want to get out of this catch block!');
});
} catch (err) {
console.log('I want to report the error from here' + err.message);
}