How can I stop a thrown error from propagating all the way down the chain? It shows in my catch()
block but it doesn't stop and crashes the server with an uncaught exception.
var run function() {
return job.getAndStore().then(function(res) {
....
}).catch(function(e) {
console.log('Just stop please...');
});
}
run();
I have to do this which I know not quite right:
try {
run();
} catch(e) {
console.log('Now it stops')
}
The run()
is part of some cron library that doesn't have any promise support so I am wrapping it in the function to call it.
Aucun commentaire:
Enregistrer un commentaire