mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[AWS|RDS] Properly rescue NotFound exceptions
The following code Fog::AWS::RDS.new.servers.get('none_such_server') now returns `nil` instead of Excon::Errors::NotFound: Expected(200) <=> Actual(404 Not Found) This regressed with excon 0.22.0.
This commit is contained in:
parent
5eebf7d760
commit
30dd43f1e8
1 changed files with 1 additions and 1 deletions
|
@ -206,7 +206,7 @@ module Fog
|
|||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
if match = error.message.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)
|
||||
if match = error.response.body.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])
|
||||
|
|
Loading…
Add table
Reference in a new issue