History

Improve error message on failed requests

Thibaut Courouble committed 8 years ago

Commit 914100a1 parent c85e4391 file · +5 −1Browse files

Unified · Split

lib/docs/core/scrapers/url_scraper.rb+5−1
@@ -35,7 +35,11 @@ module Docs · 34 unmodified lines
35 35
36 def process_response?(response)36 def process_response?(response)
37 if response.error?37 if response.error?
38 raise "Error status code (#{response.code}): #{response.return_message}\n#{response.url}"38 raise <<~ERROR
39 Error status code (#{response.code}): #{response.return_message}
40 #{response.url}
41 #{JSON.pretty_generate(response.headers).slice(2..-3)}
42 ERROR
39 elsif response.blank?43 elsif response.blank?
40 raise "Empty response body: #{response.url}"44 raise "Empty response body: #{response.url}"
41 end45 end