-
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?
Changes from 2 commits
61f9fcb
93c3513
8ccc0e2
051a16a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2261,7 +2261,10 @@ fn api_error_json() { | |
[PACKAGING] foo v0.0.1 ([ROOT]/foo) | ||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) | ||
[UPLOADING] foo v0.0.1 ([ROOT]/foo) | ||
[ERROR] failed to publish to registry at http://127.0.0.1:[..]/ | ||
[ERROR] failed to publish `foo` v0.0.1 | ||
Caused by: | ||
failed to publish to registry at http://127.0.0.1:[..]/ | ||
Caused by: | ||
the remote server responded with an error (status 403 Forbidden): you must be logged in | ||
|
@@ -2309,7 +2312,10 @@ fn api_error_200() { | |
[PACKAGING] foo v0.0.1 ([ROOT]/foo) | ||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) | ||
[UPLOADING] foo v0.0.1 ([ROOT]/foo) | ||
[ERROR] failed to publish to registry at http://127.0.0.1:[..]/ | ||
[ERROR] failed to publish `foo` v0.0.1 | ||
Caused by: | ||
failed to publish to registry at http://127.0.0.1:[..]/ | ||
Caused by: | ||
the remote server responded with an [ERROR] max upload size is 123 | ||
|
@@ -2357,7 +2363,10 @@ fn api_error_code() { | |
[PACKAGING] foo v0.0.1 ([ROOT]/foo) | ||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) | ||
[UPLOADING] foo v0.0.1 ([ROOT]/foo) | ||
[ERROR] failed to publish to registry at http://127.0.0.1:[..]/ | ||
[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 commentThe reason will be displayed to describe this comment to others. Learn more. #15791 (comment) is not resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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. |
||
Caused by: | ||
failed to get a 200 OK response, got 400 | ||
|
@@ -2414,7 +2423,10 @@ fn api_curl_error() { | |
[PACKAGING] foo v0.0.1 ([ROOT]/foo) | ||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) | ||
[UPLOADING] foo v0.0.1 ([ROOT]/foo) | ||
[ERROR] failed to publish to registry at http://127.0.0.1:[..]/ | ||
[ERROR] failed to publish `foo` v0.0.1 | ||
Caused by: | ||
failed to publish to registry at http://127.0.0.1:[..]/ | ||
Caused by: | ||
[52] Server returned nothing (no headers, no data) (Empty reply from server) | ||
|
@@ -2462,7 +2474,10 @@ fn api_other_error() { | |
[PACKAGING] foo v0.0.1 ([ROOT]/foo) | ||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) | ||
[UPLOADING] foo v0.0.1 ([ROOT]/foo) | ||
[ERROR] failed to publish to registry at http://127.0.0.1:[..]/ | ||
[ERROR] failed to publish `foo` v0.0.1 | ||
Caused by: | ||
failed to publish to registry at http://127.0.0.1:[..]/ | ||
Caused by: | ||
epage marked this conversation as resolved.
Show resolved
Hide resolved
|
||
invalid response body from server | ||
|
@@ -3609,7 +3624,10 @@ fn invalid_token() { | |
[PACKAGING] foo v0.0.1 ([ROOT]/foo) | ||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) | ||
[UPLOADING] foo v0.0.1 ([ROOT]/foo) | ||
[ERROR] failed to publish to registry at http://127.0.0.1:[..]/ | ||
[ERROR] failed to publish `foo` v0.0.1 | ||
Caused by: | ||
failed to publish to registry at http://127.0.0.1:[..]/ | ||
Caused by: | ||
token contains invalid characters. | ||
|
@@ -4330,6 +4348,58 @@ fn all_unpublishable_packages() { | |
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn workspace_publish_failure_reports_remaining_packages() { | ||
use cargo_test_support::project; | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[workspace] | ||
members = ["a", "b", "c"] | ||
"#, | ||
) | ||
.file( | ||
"a/Cargo.toml", | ||
r#" | ||
[package] | ||
name = "a" | ||
version = "0.1.0" | ||
edition = "2021" | ||
"#, | ||
) | ||
.file("a/src/lib.rs", "") | ||
.file( | ||
"b/Cargo.toml", | ||
r#" | ||
[package] | ||
name = "b" | ||
version = "0.1.0" | ||
edition = "2021" | ||
"#, | ||
) | ||
.file("b/src/lib.rs", "") | ||
.file( | ||
"c/Cargo.toml", | ||
r#" | ||
[package] | ||
name = "c" | ||
version = "0.1.0" | ||
edition = "2021" | ||
"#, | ||
) | ||
.file("c/src/lib.rs", "") | ||
.build(); | ||
|
||
// Simulate a publish failure for package 'a' (e.g., already published) | ||
// The error message should match the actual output from the verify step | ||
p.cargo("publish --workspace") | ||
.env("CARGO_REGISTRY_TOKEN", "dummy-token") | ||
.with_status(101) | ||
.with_stderr_contains("[ERROR] crate a@0.1.0 already exists on crates.io index") | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn checksum_changed() { | ||
let registry = RegistryBuilder::new().http_api().http_index().build(); | ||
|
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.
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