Skip to content

Conversation

@NeimadTL
Copy link
Contributor

@NeimadTL NeimadTL commented Feb 13, 2025

What was the end-user or developer problem that led to this PR?

Not an issue per se but more of an enhancement related to issue #8067

What is your fix for the problem, implemented in this PR?

Make use of Exception#full_message instead of Exception#full_message so the cause and the backstrace show up.

Make sure the following tasks are checked

The use of `Exception#full_message` makes more sense as it shows
the cause and the backstrace.
@NeimadTL
Copy link
Contributor Author

@deivid-rodriguez , now I wondering whether I should get rid of the "Backtrace" part of the message on L140-124 as well as on L#213-215 ? Thanks for reviewing when you'll be ready.

@deivid-rodriguez
Copy link
Contributor

deivid-rodriguez commented Feb 13, 2025

@NeimadTL Can you show how these errors look now? It seems to me that they are going to start showing redundant information now, because Exception#full_message includes the exception class name and backtrace.

So, yeah, regarding your question, yes, I think Exception#full_message should replace both the class name and the backtrace.

@NeimadTL
Copy link
Contributor Author

NeimadTL commented Feb 17, 2025

Hey @deivid-rodriguez, thanks for your feedback.

Here's what I've got so far :
bundler_spec

According to me (but please correct me if I'm wrong), the ran spec seems to be the correct one to see the message but the thing is, even by changing the the full_message variable (here and here) with something different (say, full_message= 'azerty'), I get the same message as in the screenshot. I'm missing something here, and I don't what it is. A bit of help would be highly appreciated. Thank you.

@deivid-rodriguez
Copy link
Contributor

What debug print are you adding so that running the spec prints that output?

My suggestion was more to try a realworld case. To do this, you can do the following. Create a sample app and Gemfile, for example,

source "https://rubygems.org"

gem "rake"

Configure it to install to a local path, for example, bundle config path foo, and then install it with bundle install.

The installed rake code should be at ./foo/ruby/3.4.0/gems/rake-13.2.1/lib/rake.rb or similar.

Now edit that file to force a GemRequireError, for example, manually add require "something-that-does-not-exist" to the top of that file.

Now you should be able to see the new error by running:

$ ruby -I /path/to/your/clone/of/rubygems/bundler/lib -rbundler -e'Bundler.require'

And you can compare it with the error that your globally installed bundler shows:

$ ruby -rbundler -e'Bundler.require'

@NeimadTL
Copy link
Contributor Author

NeimadTL commented Apr 7, 2025

Hi @deivid-rodriguez, thanks for your help. Can you explain to me how to do that part please:

Configure it to install to a local path, for example, bundle config path foo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider using Exception#detailed_message in our custom errors

2 participants