lib/httpx/adapters/sentry.rb in httpx-0.22.5 vs lib/httpx/adapters/sentry.rb in httpx-0.23.0
- old
+ new
@@ -41,12 +41,12 @@
def record_sentry_breadcrumb(req, res)
return unless ::Sentry.configuration.breadcrumbs_logger.include?(:http_logger)
request_info = extract_request_info(req)
- data = if response.is_a?(HTTPX::ErrorResponse)
- { error: res.message, **request_info }
+ data = if res.is_a?(HTTPX::ErrorResponse)
+ { error: res.error.message, **request_info }
else
{ status: res.status, **request_info }
end
crumb = ::Sentry::Breadcrumb.new(
@@ -62,21 +62,21 @@
return unless sentry_span
request_info = extract_request_info(req)
sentry_span.set_description("#{request_info[:method]} #{request_info[:url]}")
if res.is_a?(HTTPX::ErrorResponse)
- sentry_span.set_data(:error, res.message)
+ sentry_span.set_data(:error, res.error.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
result = {
- method: req.verb.to_s.upcase,
+ method: req.verb,
}
if ::Sentry.configuration.send_default_pii
uri += "?#{req.query}" unless req.query.empty?
result[:body] = req.body.to_s unless req.body.empty? || req.body.unbounded_body?