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
3535
3636 def process_response?(response)
3737 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
3943 elsif response.blank?
4044 raise "Empty response body: #{response.url}"
4145 end