lib/octoparts/client.rb in octoparts-0.0.2 vs lib/octoparts/client.rb in octoparts-0.0.3

- old
+ new

@@ -67,9 +67,13 @@ def process(method, path, params, headers) @connection ||= Faraday.new(url: @endpoint) do |connection| connection.adapter Faraday.default_adapter end - @connection.send(method, path, params, @headers.merge(headers || {})) + response = @connection.send(method, path, params, @headers.merge(headers || {})) + if error = Octoparts::Error.from_response(response) + raise error + end + response end end end