lib/maestrano/api/operation/base.rb in maestrano-1.0.4 vs lib/maestrano/api/operation/base.rb in maestrano-1.0.5
- old
+ new
@@ -5,11 +5,11 @@
include Preset
def self.api_url(url='')
Maestrano[self.preset].param('api.host') + Maestrano[self.preset].param('api.base') + url
end
-
+
# Perform remote request
def self.request(method, url, api_token, params={}, headers={})
unless api_token ||= Maestrano[self.preset].param('api_token')
raise Maestrano::API::Error::AuthenticationError.new('No API key provided.')
end
@@ -44,11 +44,11 @@
rescue SocketError => e
handle_restclient_error(e)
rescue NoMethodError => e
# Work around RestClient bug
if e.message =~ /\WRequestFailed\W/
- e = APIConnectionError.new('Unexpected HTTP response code')
+ e = Maestrano::API::Error::ConnectionError.new('Unexpected HTTP response code')
handle_restclient_error(e)
else
raise
end
rescue RestClient::ExceptionWithResponse => e
@@ -203,11 +203,11 @@
message = "Unexpected error communicating with Maestrano. " +
"If this problem persists, let us know at support@maestrano.com."
end
- raise APIConnectionError.new(message + "\n\n(Network error: #{e.message})")
+ raise Maestrano::API::Error::ConnectionError.new(message + "\n\n(Network error: #{e.message})")
end
end
end
end
-end
\ No newline at end of file
+end