lib/client/file-client/FileClient.js
function fileUploadRetry(fileURI, serverURI, fileUploadOptions, timeout, retries) {
  return fileUpload(fileURI, serverURI, fileUploadOptions)
  .then(function(response) {
    return response;
  }, function() {
    if (retries === 0) {
      throw new Error("Can't upload to " + JSON.stringify(serverURI));
    }
    return q.delay(timeout)
    .then(function() {
      return fileUploadRetry(fileURI, serverURI, fileUploadOptions, timeout, retries - 1);
    });
  });
}
function fileUploadRetry(fileURI, serverURI, fileUploadOptions, timeout, retries) {
  return fileUpload(fileURI, serverURI, fileUploadOptions)
  .then(function(response) {
    return response;
  }, function() {
    if (retries === 0) {
      throw new Error("Can't upload to " + JSON.stringify(serverURI));
    }
    return q.delay(timeout)
    .then(function() {
      return fileUploadRetry(fileURI, serverURI, fileUploadOptions, timeout, retries - 1);
    });
  });
}
function fileUploadRetry ( fileURI , serverURI , fileUploadOptions , timeout , retries ) { return fileUpload ( fileURI , serverURI , fileUploadOptions ) . then ( function ( response ) { return response ; } , function ( ) { if ( retries === 0 ) { throw new Error ( "Can't upload to " + JSON . stringify ( serverURI ) ) ; } return q . delay ( timeout ) . then ( function ( ) { return fileUploadRetry ( fileURI , serverURI , fileUploadOptions , timeout , retries - 1 ) ; } ) ; } ) ; }
Handling retry mechanism of the file upload.
Handling retry mechanism of the file upload .