title: How to exit downloadHandler when file doesn't exist
body: <p>I have a Shiny app with a <code>downloadButton</code>, which enables the user to download some log files.</p>
  
  <p>As the logfiles are also handled by logrotate, it might be that at a certain time no logfile exists, which currently breaks the app when trying to download it.</p>
  
  <p>How can I prevent that? Or how can I display a <code>modalDialog</code> with the information, that no log-file currently exists?</p>
  
  <p>I tried to include <code>req(F)</code> or <code>return(FALSE)</code> but they don't work.
  The current approach works, as I create an empty data.frame which is then exported, but it's not a very nice solution.</p>
  
  <pre><code>library(shiny)
  library(data.table)
  
  ## Write random log file. Uncomment the next line to make the example work.
  #fwrite(x = iris, file = "logs.log")
  
  
  ui &lt;- fluidPage(
    downloadButton("showLogs", label="", title="Logs herunterladen", icon = icon("book-open"))
  )
  
  server &lt;- function(input, output, session) {
    output$showLogs &lt;- downloadHandler(
      filename = function() {
        paste('logs-', Sys.Date(), '.csv', sep='')
      },
      content = function(file) {
        logfile &lt;- list.files(path = ".", pattern = basename("logs.log"))
        if (length(logfile) != 0) {
          logfile &lt;- fread(logfile, sep = ";", header = F)
          fwrite(logfile, file, sep = ";", row.names = FALSE)
        } else {
          ## Problem is in here
          # req(F)
          # return(FALSE)
          fwrite(data.frame("No log-Files"), file, sep = ";", row.names = FALSE)
        }
      }
    )
  }
  
  shinyApp(ui, server)
  </code></pre>