Skip to content

Commit 914100a

Browse files
committed
Improve error message on failed requests
1 parent c85e439 commit 914100a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/docs/core/scrapers/url_scraper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ def request_options
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

0 commit comments

Comments
 (0)