title: Skip $.ajax().fail() when global error handler defined
body: <p>I am defining a global jQuery error handler for status codes 500 (retry mechanism with some message, when retry exhausted). I'd like to override any <code>.fail()</code> promise that might have been added to an <code>$.ajax</code> request. My code below:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
  
              function call() {
  
                  $.ajax({
                    url: '/rest/api/v1/some_errorneous_parth',
                    retryCount:3,
                    method: 'GET'
                  }).done(function(data){
                      console.log(data);
                  }).fail(function() {
                      console.log("should not print");
                  });
              }
  
              $(document).ready(function () {
                  $.ajaxSetup({
                      retryCount: 3,
                      error: function retry(response) {
                          if(response.statuscode === 500) {
                              if(--this.retryCount){
                                  $.ajax(this);
                              }
                              else {
                                  console.log("sorry, i've 'tried everything");
                              }
                          }
                      }
                  });
              });
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;input type="button" onclick="call()" value="submit"/&gt;
      &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>I'd like the <code>should not print</code> to not be printed if the server returns 500 until the retry count gets exhausted.</p>