summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Wen <jrw2175@columbia.edu>2016-02-10 00:24:08 -0500
committerJames Wen <jrw2175@columbia.edu>2016-02-10 00:31:02 -0500
commit57af37d4748df9473aa1295fe20711ffd96c5097 (patch)
tree438de3205b7514b0d55fcef5d7b1d2df1075fa89
parent134fae9601be28d21f30e857eec0445915fbc2c1 (diff)
downloadbundler-57af37d4748df9473aa1295fe20711ffd96c5097.tar.gz
Create `Bundler::VirtualProtocolError` that `Bundler::SharedHelpers#filesystem_access`
will raise in response to Errno::EPROTO - Provides better error message/handling for #4163
-rw-r--r--lib/bundler/errors.rb9
-rw-r--r--lib/bundler/shared_helpers.rb2
-rw-r--r--spec/bundler/shared_helpers_spec.rb9
3 files changed, 20 insertions, 0 deletions
diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb
index eec8d00ef5..7b893e664f 100644
--- a/lib/bundler/errors.rb
+++ b/lib/bundler/errors.rb
@@ -98,4 +98,13 @@ module Bundler
status_code(26)
end
+
+ class VirtualProtocolError < BundlerError
+ def message
+ "There was an error relating to virtualization and file access." \
+ "It is likely that you need to grant access to or mount some file system correctly."
+ end
+
+ status_code(27)
+ end
end
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 654359d1ed..c79c88c5e1 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -107,6 +107,8 @@ module Bundler
raise PermissionError.new(path, action)
rescue Errno::EAGAIN
raise TemporaryResourceError.new(path, action)
+ rescue Errno::EPROTO
+ raise VirtualProtocolError.new
end
def const_get_safely(constant_name, namespace)
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index 330de7b98a..348889a326 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -360,6 +360,15 @@ describe Bundler::SharedHelpers do
Bundler::TemporaryResourceError)
end
end
+
+ context "system throws Errno::EPROTO" do
+ let(:file_op_block) { proc {|_path| raise Errno::EPROTO } }
+
+ it "raises a VirtualProtocolError" do
+ expect { subject.filesystem_access("/path", &file_op_block) }.to raise_error(
+ Bundler::VirtualProtocolError)
+ end
+ end
end
describe "#const_get_safely" do