more details when Typhoeus request fails

This commit is contained in:
simon lehericey 2020-12-01 22:50:41 +01:00
parent c2edf0cc72
commit 02e7de0003

View file

@ -100,7 +100,14 @@ class ApiEntreprise::API
elsif response.code == 503
raise ServiceUnavailable, "url: #{url}"
else
raise RequestFailed, "HTTP Error Code: #{response.code} for #{url}\nheaders: #{response.headers}\nbody: #{response.body}"
raise RequestFailed,
<<~TEXT
HTTP Error Code: #{response.code} for #{url}
headers: #{response.headers}
body: #{response.body}
curl message: #{response.return_message}
timeout: #{response.timed_out?}
TEXT
end
end