Skip to content

Commit

Permalink
feat(dist): refine suggestions regarding manifest checksum mismatches
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Jul 7, 2024
1 parent 3660792 commit d365542
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
17 changes: 13 additions & 4 deletions src/dist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use once_cell::sync::Lazy;
use regex::Regex;
use serde::{Deserialize, Serialize};
use thiserror::Error as ThisError;
use tracing::info;
use tracing::{info, warn};

use crate::{
config::Cfg, currentprocess::Process, errors::RustupError, toolchain::ToolchainName,
Expand Down Expand Up @@ -1169,9 +1169,18 @@ pub(crate) async fn dl_v2_manifest(
Ok(Some((manifest, manifest_hash)))
}
Err(any) => {
if let Some(RustupError::ChecksumFailed { .. }) = any.downcast_ref::<RustupError>() {
// Checksum failed - issue warning to try again later
info!("update not yet available, sorry! try again later")
if let Some(err @ RustupError::ChecksumFailed { .. }) =
any.downcast_ref::<RustupError>()
{
// Manifest checksum mismatched.
// This might indicate a transient state during an update
// on the official release server
// (see <https://github.com/rust-lang/rustup/issues/3390>)
// or a misconfiguration of a third-party release server
// (see <https://github.com/rust-lang/rustup/issues/3885>).
warn!("{err}");
info!("if you are on the official release server, this is most likely due to an update happening right now, please try again later");
info!("if you are on a third-party release server, this might indicate a problem with the server's configuration");
}
Err(any)
}
Expand Down
5 changes: 1 addition & 4 deletions tests/suite/cli_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,7 @@ async fn bad_sha_on_manifest() {
rustup::utils::raw::write_file(&sha_file, &sha_str).unwrap();
// We fail because the sha is bad, but we should emit the special message to that effect.
cx.config
.expect_err(
&["rustup", "default", "nightly"],
"update not yet available",
)
.expect_err(&["rustup", "default", "nightly"], "please try again later")
.await;
}

Expand Down

0 comments on commit d365542

Please sign in to comment.