Skip to content

Commit

Permalink
fix: don't error if a version already published (denoland#21455)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacasonato committed Dec 4, 2023
1 parent 0a738dc commit 7d5ddc4
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions cli/tools/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,28 @@ async fn perform_publish(
.send()
.await?;

let mut task = parse_response::<PublishingTask>(response)
.await
.with_context(|| {
format!(
"Failed to publish @{}/{} at {}",
package.scope, package.package, package.version
)
})?;
let res = parse_response::<PublishingTask>(response).await;
let mut task = match res {
Ok(task) => task,
Err(err) if err.code == "versionAlreadyExists" => {
println!(
"{} @{}/{}@{}",
colors::yellow("Skipping, already published"),
package.scope,
package.package,
package.version
);
continue;
}
Err(err) => {
return Err(err).with_context(|| {
format!(
"Failed to publish @{}/{} at {}",
package.scope, package.package, package.version
)
})
}
};

let interval = std::time::Duration::from_secs(2);
while task.status != "success" && task.status != "failure" {
Expand Down

0 comments on commit 7d5ddc4

Please sign in to comment.