title: HTTP error 400 in R, error handling, How to retry instead of forcing to stop?
body: <p>I am calling API to download files using <code>curl</code> package in R. Due to unknown reason, sometimes the connection breaks with error code: <code>Error in curl_download(url = i, handle = h, df) : HTTP error 400.</code></p>
  
  <p>Because I need to download about 100,000 files at a time and it's very slow, I wish R could retry once this error occurs instead of throwing me an error and stopping the script. Any thoughts?</p>
  
  <p>my code is (simple version):</p>
  
  <pre><code>for (url in allUrl) {
    df &lt;- tempfile()
      tryCatch(
        curl_download(url = url,
                      handle = h,
                      df)
      )
  }
  </code></pre>