-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix Non-actionable error messages #15799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This PR also solves the feedback received on my old fix -: #15791 New Changes include-: 1) All commits are atomic and passed cargo test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same feedback as #15791 (comment)
This commit should be able to pass as-is but it can't because its including test changes for the following commit
src/cargo/ops/registry/publish.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor: clean up publish error context and remove unused variables
Note that a "refactor" means a change to the code with no user-visible impact. If you wish to use Conventional Commits, this would be better term a fix
Also, the commit title talks about cleanup and removing a variable but the commit is about adding extra context to error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix this commit title , first i wanted to complete the implementation in this pr, I will open a new pr with proper final fixes and commits. So that the git history should be clean
tests/testsuite/publish.rs
Outdated
[ERROR] failed to publish `foo` v0.0.1 | ||
|
||
Caused by: | ||
failed to publish to registry at http://127.0.0.1:[..]/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#15791 (comment) is not resolved
Why are we reporting two
failed to publish
messages? Shouldn't we just put all of this information in the onefailed to publish
message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From @ojuschugh1 at https://github.com/rust-lang/cargo/pull/15799/files#r2252608902
Hi @epage so regarding this https://github.com/rust-lang/cargo/pull/15799/files#r2252499850 , I found out that already in some places like here there are more than one failed to publish messages so i thought to keep like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi , @epage We show two lines because Cargo prints the error chain: the top-level is a workspace-specific summary (which crate failed + what’s left), and the “Caused by” line is the transport/server detail. This keeps it readable and preserves single-crate behavior. If you prefer one line, I can collapse it and update tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we extend the original error to include the context? Seems like that would provide much better results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will try to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@epage , I have fixed this. Kindly please review and let me know, if anything else you want me to do.
…failure - Keep single-crate error format unchanged - Add test for workspace failure messaging
Avoid duplicate "failed to publish" text by combining workspace info with original error message. Fixes rust-lang#15754.
Could you edit the title to make it clearer what this is about at first glance? |
Sure no issues |
What does this PR try to resolve?
This PR fixes issue #15754 by improving error reporting for workspace publish failures.
Previously, when publishing a workspace, if one package failed (e.g., due to an existing version), Cargo did not clearly list which packages failed and which remained unpublished.
This change ensures that the error message now includes both the failed package and any remaining unpublished packages, making it easier for users to understand what went wrong and what still needs to be published.
How to test and review this PR?
workspace_publish_failure_reports_remaining_packages
) was added to publish.rs to demonstrate the previous behavior and verify the fix.SNAPSHOTS=overwrite cargo test
).How to test locally:
SNAPSHOTS=overwrite cargo test --test testsuite publish::workspace_publish_failure_reports_remaining_packages
or simply
SNAPSHOTS=overwrite cargo test
or
cargo test
to run the full suite.