19 lines
504 B
Ruby
19 lines
504 B
Ruby
|
class ApiEntreprise::API::Error < ::StandardError
|
||
|
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}
|
||
|
body: #{CGI.escape(response.body)}
|
||
|
curl message: #{response.return_message}
|
||
|
total time: #{response.total_time}
|
||
|
connect time: #{response.connect_time}
|
||
|
response headers: #{response.headers}
|
||
|
TEXT
|
||
|
|
||
|
super(msg)
|
||
|
end
|
||
|
end
|