Skip to content

Commit

Permalink
Use response method on Faraday error for older versions of the library
Browse files Browse the repository at this point in the history
  • Loading branch information
estolfo committed Sep 25, 2023
1 parent c62fbc5 commit 300fc94
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/elastic_apm/spies/faraday.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def run_request(method, url, body, headers, &block)
yield req if block
end
rescue Faraday::ClientError, Faraday::ServerError => e # Faraday::Response::RaiseError
status = e.response_status
status = e.response_status if e.respond_to?(:response_status)
status ||= e.response&.fetch(:status)
http = span&.context&.http
if http && status
http.status_code = status.to_s
Expand Down

0 comments on commit 300fc94

Please sign in to comment.