Give better errors when materialization fails #4788
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was the end-user or developer problem that led to this PR?
When materialization fails, the error user gets can be confusing because it only shows the first gem that failed to be materialized. Sometimes it can be a single gem that's missing, sometimes it can be the whole bundle. Showing only the first gem that fails to materialize can lead end users into thinking there's a specific issue with that single gem, so this PR changes bundler to show the complete list of gems that failed to be materialized.
What is your fix for the problem, implemented in this PR?
My fix is to refactor the current implementation to be able to show the full list of gems that failed to be materialized. It's a bit more work, but it only happens on errors, so definitely not a critical code path, and as a result it allows us to simplify code in
Bundler::Definition
(our main "god class") and inBundler::SpecSec
(another complicated class).In addition, I added a
bundle install
hint for when this error happens when runningbundle list
beforebundle install
, like we do in other cases likebundler/setup
orbundle check
.I made this work while working on #4782, but I think it's justified as a separate improvement.
Make sure the following tasks are checked