lib/httpx/adapters/sentry.rb in httpx-0.22.1 vs lib/httpx/adapters/sentry.rb in httpx-0.22.2
- old
+ new
@@ -61,10 +61,14 @@
def record_sentry_span(req, res, sentry_span)
return unless sentry_span
request_info = extract_request_info(req)
sentry_span.set_description("#{request_info[:method]} #{request_info[:url]}")
- sentry_span.set_data(:status, res.status)
+ if res.is_a?(HTTPX::ErrorResponse)
+ sentry_span.set_data(:error, res.message)
+ else
+ sentry_span.set_data(:status, res.status)
+ end
sentry_span.set_timestamp(::Sentry.utc_now.to_f)
end
def extract_request_info(req)
uri = req.uri