From 8f705c2f64cf5ef7c1cf758bab8036bae9d86438 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 5 Jul 2012 07:13:40 +0000 Subject: clarify error when File.open fails on source file Retrying to open a source file that cannot be opened (repeatedly) and finally raising NoStorageNodesError is confusing to users. --- lib/mogilefs/http_file.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-24-ge0c7