diff options
Diffstat (limited to 'src/watch/sources.rs')
| -rw-r--r-- | src/watch/sources.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/watch/sources.rs b/src/watch/sources.rs index 7b56774..9767cef 100644 --- a/src/watch/sources.rs +++ b/src/watch/sources.rs @@ -15,7 +15,7 @@ use std::path::Path; use crate::config::Config; use crate::db::Db; -use crate::error::{Error, Result}; +use crate::error::{Error, Guard, Result}; use crate::watch::digests::{cached_path, download_and_cache}; use crate::watch::mirror::read_tree; @@ -36,9 +36,11 @@ pub fn verify_cached(cfg: &Config, db: &Db, url: &str, digest: &str) -> Result<( None => download_and_cache(cfg, db, url)?.0, }; if found != digest { - return Err(Error::fail_closed(format!( - "source {url} hashed to {found} but the candidate recorded {digest}" - ))); + return Err(Error::fail_closed(Guard::DigestMismatch { + url: url.to_string(), + expected: digest.to_string(), + found, + })); } Ok(()) } |
