I have code that looks somewhat like this (less ridiculous, of course):
var d = $.Deferred();
d.pipe(function() {
throw "a";
}).then(function() {
console.log("good!");
}, function(e) {
console.log("I want the exception here");
});
d.resolve();
The problem is that throwing an exception in a .pipe
doneFilter
does not seem to make jQuery consider it as a failure and it results in an uncaught exception in the doneFilter
.
An alternative is to create a new deferred and throw a try-catch block around the doneFilter
, but I was wondering if there was a better way to go about it.