diff --git a/lib/solr_wrapper/downloader.rb b/lib/solr_wrapper/downloader.rb index af2636f..5bc1788 100644 --- a/lib/solr_wrapper/downloader.rb +++ b/lib/solr_wrapper/downloader.rb @@ -7,6 +7,8 @@ def self.fetch_with_progressbar(url, output) pbar = SafeProgressBar.new(title: File.basename(url), total: nil, format: '%t: |%B| %p%% (%e )') response = HTTP.follow.get(url) + raise SolrWrapperError, "Unable to download from #{url}, (#{response.status})" unless response.status.success? + pbar.total = response.headers['content-length'].to_i File.open(output, 'wb') do |f|