diff --git a/lib/fog/storage/models/aws/files.rb b/lib/fog/storage/models/aws/files.rb index 4e4b4ea60..12520312c 100644 --- a/lib/fog/storage/models/aws/files.rb +++ b/lib/fog/storage/models/aws/files.rb @@ -65,8 +65,15 @@ module Fog }) normalise_headers(file_data) new(file_data) - rescue Excon::Errors::NotFound - nil + rescue Excon::Errors::NotFound => error + case error.message + when /NoSuchKey<\/Code>/ + nil + when /NoSuchBucket<\/Code>/ + raise(Fog::AWS::DNS::NotFound.new("Directory #{directory.identity} does not exist.")) + else + raise(error) + end end def get_url(key, expires)