8000 improve trusted publishing error message · rust-lang/crates.io@c87f8b0 · GitHub
[go: up one dir, main page]

Skip to content

Commit c87f8b0

Browse files
committed
improve trusted publishing error message
1 parent 22b19b5 commit c87f8b0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/controllers/krate/publish.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ pub async fn publish(app: AppState, req: Parts, body: Body) -> AppResult<Json<Go
164164

165165
let auth = if let Some(trustpub_token) = trustpub_token {
166166
let Some(existing_crate) = &existing_crate else {
167-
let error = forbidden("Trusted Publishing tokens do not support creating new crates");
167+
let error = forbidden(
168+
"Trusted Publishing tokens do not support creating new crates. Publish the crate manually, first",
169+
);
168170
return Err(error);
169171
};
170172

src/tests/krate/publish/trustpub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ async fn test_non_existent_token_with_new_crate() -> anyhow::Result<()> {
297297
let pb = PublishBuilder::new("foo", "1.0.0");
298298
let response = oidc_token_client.publish_crate(pb).await;
299299
assert_snapshot!(response.status(), @"403 Forbidden");
300-
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Trusted Publishing tokens do not support creating new crates"}]}"#);
300+
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Trusted Publishing tokens do not support creating new crates. Publish the crate manually, first"}]}"#);
301301

302302
Ok(())
303303
}

0 commit comments

Comments
 (0)
0