lib/mashery/client.rb in mashery-0.1.0 vs lib/mashery/client.rb in mashery-0.1.1

- old
+ new

@@ -24,9 +24,10 @@ if Mashery.logger Mashery.logger.debug("Calling method #{method} with params #{params.inspect} on URI #{signed_uri}") end req = ::JSON[{:version => '1.1', :method => method, :params => params, :id => 1}] response = HTTParty.post(signed_uri, :body => req) + raise HttpException.new(response.headers['x-mashery-error-code']) unless response.code < 300 res = ::JSON[response.body] raise Exception.create(res['error']) if res.include?('error') res['result'] end