From 36348f62706fbb70c19cba2405246d07396b62ef Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Sat, 31 Jan 2026 10:38:21 -0600 Subject: [PATCH] Improve the wording of publish errors during dry-run --- crates/uv-publish/src/lib.rs | 6 +++--- crates/uv/tests/it/publish.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/uv-publish/src/lib.rs b/crates/uv-publish/src/lib.rs index 5d675998a1653..f06257d6f01c5 100644 --- a/crates/uv-publish/src/lib.rs +++ b/crates/uv-publish/src/lib.rs @@ -66,7 +66,7 @@ pub enum PublishError { Box, #[source] Box, ), - #[error("Unable to publish `{}` to {}", _0.user_display(), _1)] + #[error("Validation failed for `{}` on {}", _0.user_display(), _1)] Validate( PathBuf, Box, @@ -126,9 +126,9 @@ pub enum PublishPrepareError { pub enum PublishSendError { #[error("Failed to send POST request")] ReqwestMiddleware(#[source] reqwest_middleware::Error), - #[error("Upload failed with status {0}")] + #[error("Server returned status code {0}")] StatusNoBody(StatusCode, #[source] reqwest::Error), - #[error("Upload failed with status code {0}. Server says: {1}")] + #[error("Server returned status code {0}. Server says: {1}")] Status(StatusCode, String), #[error( "POST requests are not supported by the endpoint, are you using the simple index URL instead of the upload URL?" diff --git a/crates/uv/tests/it/publish.rs b/crates/uv/tests/it/publish.rs index 1cafffbd7f248..e2a18b76237bd 100644 --- a/crates/uv/tests/it/publish.rs +++ b/crates/uv/tests/it/publish.rs @@ -41,7 +41,7 @@ fn username_password_no_longer_supported() { Publishing 1 file to https://test.pypi.org/legacy/ Uploading ok-1.0.0-py3-none-any.whl ([SIZE]) error: Failed to publish `[WORKSPACE]/test/links/ok-1.0.0-py3-none-any.whl` to https://test.pypi.org/legacy/ - Caused by: Upload failed with status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers + Caused by: Server returned status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers " ); } @@ -66,7 +66,7 @@ fn invalid_token() { Publishing 1 file to https://test.pypi.org/legacy/ Uploading ok-1.0.0-py3-none-any.whl ([SIZE]) error: Failed to publish `[WORKSPACE]/test/links/ok-1.0.0-py3-none-any.whl` to https://test.pypi.org/legacy/ - Caused by: Upload failed with status code 403 Forbidden. Server says: 403 Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information. + Caused by: Server returned status code 403 Forbidden. Server says: 403 Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information. " ); } @@ -250,7 +250,7 @@ fn check_keyring_behaviours() { Publishing 1 file to https://test.pypi.org/legacy/?ok Uploading ok-1.0.0-py3-none-any.whl ([SIZE]) error: Failed to publish `[WORKSPACE]/test/links/ok-1.0.0-py3-none-any.whl` to https://test.pypi.org/legacy/?ok - Caused by: Upload failed with status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers + Caused by: Server returned status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers " ); @@ -275,7 +275,7 @@ fn check_keyring_behaviours() { warning: Using `--keyring-provider` with a password or token and no check URL has no effect Uploading ok-1.0.0-py3-none-any.whl ([SIZE]) error: Failed to publish `[WORKSPACE]/test/links/ok-1.0.0-py3-none-any.whl` to https://test.pypi.org/legacy/?ok - Caused by: Upload failed with status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers + Caused by: Server returned status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers " ); @@ -305,7 +305,7 @@ fn check_keyring_behaviours() { Keyring request for dummy@https://test.pypi.org/legacy/?ok Keyring request for dummy@test.pypi.org error: Failed to publish `[WORKSPACE]/test/links/ok-1.0.0-py3-none-any.whl` to https://test.pypi.org/legacy/?ok - Caused by: Upload failed with status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers + Caused by: Server returned status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers " ); @@ -330,7 +330,7 @@ fn check_keyring_behaviours() { Keyring request for dummy@https://test.pypi.org/legacy/?ok Uploading ok-1.0.0-py3-none-any.whl ([SIZE]) error: Failed to publish `[WORKSPACE]/test/links/ok-1.0.0-py3-none-any.whl` to https://test.pypi.org/legacy/?ok - Caused by: Upload failed with status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers + Caused by: Server returned status code 403 Forbidden. Server says: 403 Username/Password authentication is no longer supported. Migrate to API Tokens or Trusted Publishers instead. See https://test.pypi.org/help/#apitoken and https://test.pypi.org/help/#trusted-publishers " ); }