code: function (defer, xhr) {
                  var errorType = xhr.type || xhr.status;
                  var errorMessage = xhr.responseText || xhr.message || xhr.statusText;
                  defer.reject(new ApiError(errorType, errorMessage));
              }
docs: Rejects deferred promise.
  
  @param {vow.Deferred} defer
  @param {XMLHttpRequest} xhr