lib/soapy_cake/client.rb in soapy_cake-2.2.1 vs lib/soapy_cake/client.rb in soapy_cake-2.2.3

- old
+ new

@@ -34,11 +34,11 @@ end end protected - attr_reader :domain, :api_key, :time_converter, :opts, :logger, :retry_count, :write_enabled + attr_reader :domain, :api_key, :time_converter, :opts, :retry_count, :write_enabled private def fetch_opt(key, fallback = nil) opts.fetch(key, ENV.fetch("CAKE_#{key.to_s.upcase}", fallback)) @@ -80,10 +80,15 @@ http_request = Net::HTTP::Post.new(request.path, HEADERS) http_request.body = request.xml response = perform_http_request(http_request) unless response.is_a?(Net::HTTPSuccess) - raise RequestFailed, "Request failed with HTTP #{response.code}: #{response.body}" + raise RequestFailed.new( + "Request failed with HTTP #{response.code}", + request_path: request.path, + request_body: http_request.body, + response_body: response.body + ) end response.body end