Merge pull request #5182 from betagouv/5113-async-for-api-ent-calls

raise exception with url
This commit is contained in:
Keirua 2020-05-20 16:11:40 +02:00 committed by GitHub
commit af6731578a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,11 +74,11 @@ class ApiEntreprise::API
if response.success? if response.success?
JSON.parse(response.body, symbolize_names: true) JSON.parse(response.body, symbolize_names: true)
elsif response.code&.between?(401, 499) elsif response.code&.between?(401, 499)
raise ResourceNotFound raise ResourceNotFound, "url: #{url}"
elsif response.code == 400 elsif response.code == 400
raise BadFormatRequest raise BadFormatRequest, "url: #{url}"
else else
raise RequestFailed, "HTTP Error Code: #{response.code}" raise RequestFailed, "HTTP Error Code: #{response.code} for #{url}"
end end
end end