Skip to content

Commit 62a92c3

Browse files
NeimadTLhsbt
authored andcommitted
Update custom errors with Exception#full_message
The use of `Exception#full_message` makes more sense as it shows the cause and the backstrace.
1 parent e415480 commit 62a92c3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bundler/lib/bundler/errors.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class GemRequireError < BundlerError
131131
attr_reader :orig_exception
132132

133133
def initialize(orig_exception, msg)
134-
full_message = msg + "\nGem Load Error is: #{orig_exception.message}\n"\
134+
full_message = msg + "\nGem Load Error is:
135+
#{orig_exception.full_message(highlight: false)}\n"\
135136
"Backtrace for gem load error is:\n"\
136137
"#{orig_exception.backtrace.join("\n")}\n"\
137138
"Bundler Error Backtrace:\n"
@@ -221,7 +222,9 @@ def initialize(underlying_error, message)
221222
class DirectoryRemovalError < BundlerError
222223
def initialize(orig_exception, msg)
223224
full_message = "#{msg}.\n" \
224-
"The underlying error was #{orig_exception.class}: #{orig_exception.message}, with backtrace:\n" \
225+
"The underlying error was #{orig_exception.class}:
226+
#{orig_exception.full_message(highlight: false)},
227+
with backtrace:\n" \
225228
" #{orig_exception.backtrace.join("\n ")}\n\n" \
226229
"Bundler Error Backtrace:"
227230
super(full_message)

0 commit comments

Comments
 (0)