lib/moneta/api/service_methods.rb in moneta-api-1.7.0 vs lib/moneta/api/service_methods.rb in moneta-api-1.8.0

- old
+ new

@@ -190,12 +190,21 @@ message: request.respond_to?(:to_hash) ? request.to_hash : request }) ResponseFactory.build(response) rescue Savon::SOAPFault => e - raise Moneta::Api::RuntimeException.new(e.message) + error_details = e.to_hash[:fault] + + message = error_details[:faultstring] + code = error_details[:faultcode] + detail = error_details[:detail] + + raise Moneta::Api::RuntimeException.new(code, message, detail) rescue Savon::HTTPError => e - raise Moneta::Api::HTTPException.new(e.message) + http = e.http + raise Moneta::Api::HTTPException.new(http.code, http.body) + rescue HTTPI::Error => e + raise Moneta::Api::ConnectionException.new(e.message) end def validate!(method, request) expected_request_class = get_expected_request_class(method)