From 8ffa53309060c3ddbf4ea986ff09518dd343d542 Mon Sep 17 00:00:00 2001 From: Michael Sawyer Date: Thu, 20 Apr 2017 15:36:39 -0700 Subject: [PATCH] ET-2352 Throw RequestLimitExceeded error if out of retries. --- lib/fog/aws/compute.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fog/aws/compute.rb b/lib/fog/aws/compute.rb index 75c6e8690..4e31f091a 100644 --- a/lib/fog/aws/compute.rb +++ b/lib/fog/aws/compute.rb @@ -3,6 +3,8 @@ module Fog class AWS < Fog::Service extend Fog::AWS::CredentialFetcher::ServiceMethods + class RequestLimitExceeded < Fog::Errors::Error; end + requires :aws_access_key_id, :aws_secret_access_key recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, :aws_session_token, :use_iam_profile, :aws_credentials_expire_at, :instrumentor, :instrumentor_name, :version @@ -560,7 +562,7 @@ module Fog sleep (2.0 ** (1.0 + retries) * 100) / 1000.0 _request(body, headers, idempotent, parser, retries + 1) else - Fog::Compute::AWS::Error.slurp(error, "Max retries exceeded (#{max_retries}) #{match[:code]} => #{match[:message]}") + Fog::Compute::AWS::RequestLimitExceeded.slurp(error, "Max retries exceeded (#{max_retries}) #{match[:code]} => #{match[:message]}") end else Fog::Compute::AWS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")