summaryrefslogtreecommitdiff
path: root/lib/bundler/errors.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-05-25 11:03:33 +0200
committergit <svn-admin@ruby-lang.org>2022-05-27 17:26:22 +0900
commit6778d321a7fa0ec56e3e02b6f3739a035c7ef41a (patch)
tree278712da8c20b1ba77762570756ff85a1856e74f /lib/bundler/errors.rb
parent45177129a75c5bfd03933b82076e8dc49acc500f (diff)
[rubygems/rubygems] Show better error when previous installation fails to be removed
Instead of guessing on the culprit. We actually have a helper, `Bundler.rm_rf`, with exactly the behavior that we want: * Allow the passed folder to not exist. * No exception swallowing other than that. https://github.com/rubygems/rubygems/commit/5fa3e6f04a
Diffstat (limited to 'lib/bundler/errors.rb')
-rw-r--r--lib/bundler/errors.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb
index 9ad7460e58..0bc1a860df 100644
--- a/lib/bundler/errors.rb
+++ b/lib/bundler/errors.rb
@@ -79,10 +79,6 @@ module Bundler
case @permission_type
when :create
"executable permissions for all parent directories and write permissions for `#{parent_folder}`"
- when :delete
- permissions = "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
- permissions += ", and the same thing for all subdirectories inside #{@path}" if File.directory?(@path)
- permissions
else
"#{@permission_type} permissions for that path"
end
@@ -172,4 +168,16 @@ module Bundler
status_code(32)
end
+
+ class DirectoryRemovalError < BundlerError
+ def initialize(orig_exception, msg)
+ full_message = "#{msg}.\n" \
+ "The underlying error was #{orig_exception.class}: #{orig_exception.message}, with backtrace:\n" \
+ " #{orig_exception.backtrace.join("\n ")}\n\n" \
+ "Bundler Error Backtrace:"
+ super(full_message)
+ end
+
+ status_code(36)
+ end
end