[ruby/rubygems] Update custom errors with Exception#full_message

The use of `Exception#full_message` makes more sense as it shows
the cause and the backstrace.

https://github.com/ruby/rubygems/commit/62a92c3f5e
This commit is contained in:
neimadTL 2025-02-13 09:32:33 -04:00 committed by git
parent e1087c1226
commit 8846799686

View File

@ -131,7 +131,8 @@ module Bundler
attr_reader :orig_exception
def initialize(orig_exception, msg)
full_message = msg + "\nGem Load Error is: #{orig_exception.message}\n"\
full_message = msg + "\nGem Load Error is:
#{orig_exception.full_message(highlight: false)}\n"\
"Backtrace for gem load error is:\n"\
"#{orig_exception.backtrace.join("\n")}\n"\
"Bundler Error Backtrace:\n"
@ -221,7 +222,9 @@ module Bundler
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" \
"The underlying error was #{orig_exception.class}:
#{orig_exception.full_message(highlight: false)},
with backtrace:\n" \
" #{orig_exception.backtrace.join("\n ")}\n\n" \
"Bundler Error Backtrace:"
super(full_message)