From 8a1d31506f06882c0013e29d9febc908bfdb058a Mon Sep 17 00:00:00 2001 From: geemus Date: Fri, 27 May 2011 11:07:31 -0700 Subject: [PATCH] [aws|storage] discern between no file and no directory for files.get closes #160 --- lib/fog/storage/models/aws/files.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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)