2020-08-05 18:40:47 +02:00
|
|
|
class APIEntreprise::API::Error < ::StandardError
|
2020-12-03 16:52:58 +01:00
|
|
|
def initialize(response)
|
|
|
|
# use uri to avoid sending token
|
|
|
|
uri = URI.parse(response.effective_url)
|
|
|
|
|
|
|
|
msg = <<~TEXT
|
|
|
|
url: #{uri.host}#{uri.path}
|
|
|
|
HTTP error code: #{response.code}
|
2024-04-05 09:42:55 +02:00
|
|
|
body: #{response.body}
|
2020-12-03 16:52:58 +01:00
|
|
|
curl message: #{response.return_message}
|
|
|
|
total time: #{response.total_time}
|
|
|
|
connect time: #{response.connect_time}
|
|
|
|
response headers: #{response.headers}
|
|
|
|
TEXT
|
|
|
|
|
|
|
|
super(msg)
|
|
|
|
end
|
2022-09-16 00:32:17 +02:00
|
|
|
|
|
|
|
def network_error?
|
|
|
|
true
|
|
|
|
end
|
2020-12-03 16:52:58 +01:00
|
|
|
end
|