mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|iam] Simplify error handling code for errors with custom classes
This commit is contained in:
parent
bef207f4ae
commit
33b1e16080
1 changed files with 2 additions and 10 deletions
|
@ -156,16 +156,8 @@ module Fog
|
|||
case match[1]
|
||||
when 'CertificateNotFound', 'NoSuchEntity'
|
||||
raise Fog::AWS::IAM::NotFound.slurp(error, match[2])
|
||||
when 'EntityAlreadyExists'
|
||||
raise Fog::AWS::IAM::EntityAlreadyExists.slurp(error, match[2])
|
||||
when 'KeyPairMismatch'
|
||||
raise Fog::AWS::IAM::KeyPairMismatch.slurp(error, match[2])
|
||||
when 'LimitExceeded'
|
||||
raise Fog::AWS::IAM::LimitExceeded.slurp(error, match[2])
|
||||
when 'MalformedCertificate'
|
||||
raise Fog::AWS::IAM::MalformedCertificate.slurp(error, match[2])
|
||||
when 'ValidationError'
|
||||
raise Fog::AWS::IAM::ValidationError.slurp(error, match[2])
|
||||
when 'EntityAlreadyExists', 'KeyPairMismatch', 'LimitExceeded', 'MalformedCertificate', 'ValidationError'
|
||||
raise Fog::AWS::IAM.const_get(match[1]).slurp(error, match[2])
|
||||
else
|
||||
raise Fog::AWS::IAM::Error.slurp(error, "#{match[1]} => #{match[2]}") if match[1]
|
||||
raise
|
||||
|
|
Loading…
Reference in a new issue