Skip to content

Commit 04c7ff2

Browse files
committed
notifications: log directly when failing to update hash file
1 parent 8c16b13 commit 04c7ff2

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/dist/download.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::path::{Path, PathBuf};
55
use anyhow::{Context, Result, anyhow};
66
use sha2::{Digest, Sha256};
77
use tracing::debug;
8+
use tracing::warn;
89
use url::Url;
910

1011
use crate::dist::temp;
@@ -160,7 +161,7 @@ impl<'a> DownloadCfg<'a> {
160161
return Ok(None);
161162
}
162163
} else {
163-
(self.notify_handler)(Notification::CantReadUpdateHash(hash_file));
164+
warn!(file = %hash_file.display(), "can't read update hash file, can't skip update");
164165
}
165166
} else {
166167
(self.notify_handler)(Notification::NoUpdateHash(hash_file));

src/notifications.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use crate::{dist::ToolchainDesc, toolchain::ToolchainName, utils::notify::Notifi
1111

1212
#[derive(Debug)]
1313
pub(crate) enum Notification<'a> {
14-
CantReadUpdateHash(&'a Path),
1514
NoUpdateHash(&'a Path),
1615
FileAlreadyDownloaded,
1716
CachedFileChecksumFailed,
@@ -84,8 +83,7 @@ impl Notification<'_> {
8483
| SkippingNightlyMissingComponent(_, _, _)
8584
| RetryingDownload(_)
8685
| DownloadedManifest(_, _) => NotificationLevel::Info,
87-
CantReadUpdateHash(_)
88-
| MissingInstalledComponent(_)
86+
MissingInstalledComponent(_)
8987
| CachedFileChecksumFailed
9088
| ForcingUnavailableComponent(_)
9189
| StrayHash(_) => NotificationLevel::Warn,
@@ -123,11 +121,6 @@ impl Display for Notification<'_> {
123121
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> {
124122
use self::Notification::*;
125123
match self {
126-
CantReadUpdateHash(path) => write!(
127-
f,
128-
"can't read update hash file: '{}', can't skip update...",
129-
path.display()
130-
),
131124
NoUpdateHash(path) => write!(f, "no update hash at: '{}'", path.display()),
132125
FileAlreadyDownloaded => write!(f, "reusing previously downloaded file"),
133126
CachedFileChecksumFailed => write!(f, "bad checksum for cached download"),

0 commit comments

Comments
 (0)