diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-07-05 07:13:40 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-07-05 07:13:40 +0000 |
commit | 8f705c2f64cf5ef7c1cf758bab8036bae9d86438 (patch) | |
tree | d6e5f35b1a3f86a622862942850e425907681878 | |
parent | 5cd52d27f6472e82809126cabb06af913ed0e358 (diff) | |
download | mogilefs-client-8f705c2f64cf5ef7c1cf758bab8036bae9d86438.tar.gz |
Retrying to open a source file that cannot be opened (repeatedly) and finally raising NoStorageNodesError is confusing to users.
-rw-r--r-- | lib/mogilefs/http_file.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/mogilefs/http_file.rb b/lib/mogilefs/http_file.rb index 8784f68..7871940 100644 --- a/lib/mogilefs/http_file.rb +++ b/lib/mogilefs/http_file.rb @@ -105,7 +105,13 @@ class MogileFS::HTTPFile < StringIO if @big_io.respond_to?(:stat) stat = @big_io.stat elsif String === @big_io || @big_io.respond_to?(:to_path) - file = File.open(@big_io) + begin + file = File.open(@big_io) + rescue => e + msg = "Failed to open input (#{@big_io.inspect}): " \ + "#{e.message} (#{e.class})" + raise NonRetryableError, msg, e.backtrace + end stat = file.stat elsif @big_io.respond_to?(:size) size = @big_io.size |