summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-05-24 15:23:13 +0200
committergit <svn-admin@ruby-lang.org>2022-05-25 01:17:59 +0900
commit9fdef28687fba5e01d0ee6a2422dba9dd0f7d1b9 (patch)
tree6ccc09130ab8902436ff7915f9b8bf5b2f92639e /lib
parentc603f897a33bf6237ac1051965fffbc013abee5f (diff)
[rubygems/rubygems] Show exception cause in bug report template
https://github.com/rubygems/rubygems/commit/84b163e804
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/friendly_errors.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index cc615db60c..ff6cdc4123 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -65,8 +65,7 @@ module Bundler
--- ERROR REPORT TEMPLATE -------------------------------------------------------
```
- #{e.class}: #{e.message}
- #{e.backtrace && e.backtrace.join("\n ").chomp}
+ #{exception_message(e)}
```
#{Bundler::Env.report}
@@ -85,6 +84,21 @@ module Bundler
EOS
end
+ def exception_message(error)
+ message = serialized_exception_for(error)
+ cause = error.cause
+ return message unless cause
+
+ message + serialized_exception_for(cause)
+ end
+
+ def serialized_exception_for(e)
+ <<-EOS.gsub(/^ {8}/, "")
+ #{e.class}: #{e.message}
+ #{e.backtrace && e.backtrace.join("\n ").chomp}
+ EOS
+ end
+
def issues_url(exception)
message = exception.message.lines.first.tr(":", " ").chomp
message = message.split("-").first if exception.is_a?(Errno)