Skip to content

Commit 0efeaa5

Browse files
committed
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 dab1f9a commit 0efeaa5

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
@@ -135,7 +135,8 @@ class GemRequireError < BundlerError
135135
attr_reader :orig_exception
136136

137137
def initialize(orig_exception, msg)
138-
full_message = msg + "\nGem Load Error is: #{orig_exception.message}\n"\
138+
full_message = msg + "\nGem Load Error is:
139+
#{orig_exception.full_message(highlight: false)}\n"\
139140
"Backtrace for gem load error is:\n"\
140141
"#{orig_exception.backtrace.join("\n")}\n"\
141142
"Bundler Error Backtrace:\n"
@@ -207,7 +208,9 @@ def initialize(underlying_error, message)
207208
class DirectoryRemovalError < BundlerError
208209
def initialize(orig_exception, msg)
209210
full_message = "#{msg}.\n" \
210-
"The underlying error was #{orig_exception.class}: #{orig_exception.message}, with backtrace:\n" \
211+
"The underlying error was #{orig_exception.class}:
212+
#{orig_exception.full_message(highlight: false)},
213+
with backtrace:\n" \
211214
" #{orig_exception.backtrace.join("\n ")}\n\n" \
212215
"Bundler Error Backtrace:"
213216
super(full_message)

0 commit comments

Comments
 (0)