Error Handling and Recovery with jQuery Deferred
<p>I am using jQuery and am aware that this issue is because the jQuery.Deferred implementation is not Promises/A+ compiant. I do not want to use any other libraries to solve this.</p>

<p>With that out of the way, is there a way to recover from a <code>$.Deferred().fail()</code> callback such that I am returned back to the success chain? This is possible with the multi-callback form of <code>then()</code> but so far I have not found a solution using <code>.fail()</code></p>

<p>then:</p>

<pre><code>asyncThatWillFail().then(function () {
    // useless callback
}, function () {
    console.log("error");
    return $.Deferred().resolve();
}).then(function () {
    console.log("continuing on success chain");
});
</code></pre>

<p>fail (does not work):</p>

<pre><code>asyncThatWillFail().fail(function () {
    console.log("error");
    return $.Deferred().resolve();
}).then(function () {
    console.log("continuing on success chain");
});
</code></pre>

<p>In my case I only need to check for failure, set a flag, and continue with what I was doing. I simply don't need the parallel success handler in the "then" example.</p>

<p>Here is a <a href="https://jsfiddle.net/86d29j1L/2/" rel="nofollow">jsFiddle</a> to further clarify what I mean.</p>