mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fix for AWS error message parsing
This commit is contained in:
parent
e5e6b2a1b2
commit
5e3ee29e58
9 changed files with 9 additions and 9 deletions
|
@ -151,7 +151,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code>.*<Message>(.*)<\/Message>/)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
case match[1]
|
||||
when 'AlreadyExists'
|
||||
#raise Fog::AWS::AutoScaling::IdentifierTaken.new(match[2])
|
||||
|
|
|
@ -131,7 +131,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.response.body.match(/<Code>(.*)<\/Code>[ \t\n]*<Message>(.*)<\/Message>/)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
raise case match[1].split('.').last
|
||||
when 'InvalidParameterValue'
|
||||
Fog::AWS::ElasticBeanstalk::InvalidParameterError.slurp(error, match[2])
|
||||
|
|
|
@ -106,7 +106,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
raise case match[1].split('.').last
|
||||
when 'NotFound'
|
||||
Fog::AWS::Compute::NotFound.slurp(error, match[2])
|
||||
|
|
|
@ -391,7 +391,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
raise case match[1].split('.').last
|
||||
when 'NotFound', 'Unknown'
|
||||
Fog::Compute::AWS::NotFound.slurp(error, match[2])
|
||||
|
|
|
@ -104,7 +104,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code>/m)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>?)/m)
|
||||
case match[1]
|
||||
when 'CacheSecurityGroupNotFound', 'CacheParameterGroupNotFound',
|
||||
'CacheClusterNotFound'
|
||||
|
|
|
@ -191,7 +191,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code>(?:.*<Message>(.*)<\/Message>)?/m)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
case match[1]
|
||||
when 'CertificateNotFound'
|
||||
raise Fog::AWS::IAM::NotFound.slurp(error, match[2])
|
||||
|
|
|
@ -205,7 +205,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code>(?:.*<Message>(.*)<\/Message>)?/m)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
case match[1]
|
||||
when 'CertificateNotFound', 'NoSuchEntity'
|
||||
raise Fog::AWS::IAM::NotFound.slurp(error, match[2])
|
||||
|
|
|
@ -206,7 +206,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code>[\s\\\w]+<Message>(.*)<\/Message>/m)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
case match[1].split('.').last
|
||||
when 'DBInstanceNotFound', 'DBParameterGroupNotFound', 'DBSnapshotNotFound', 'DBSecurityGroupNotFound'
|
||||
raise Fog::AWS::RDS::NotFound.slurp(error, match[2])
|
||||
|
|
|
@ -114,7 +114,7 @@ module Fog
|
|||
|
||||
response
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code>(?:.*<Message>(.*)<\/Message>)?/m)
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
case match[1]
|
||||
when 'EntityAlreadyExists', 'KeyPairMismatch', 'LimitExceeded', 'MalformedCertificate', 'ValidationError'
|
||||
raise Fog::AWS::STS.const_get(match[1]).slurp(error, match[2])
|
||||
|
|
Loading…
Add table
Reference in a new issue