mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
report filename when unable to read data
This commit is contained in:
parent
18a6218a77
commit
a4d33dbdb0
2 changed files with 8 additions and 3 deletions
|
@ -151,7 +151,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// add entry to the list
|
// add entry to the list
|
||||||
let sha1 = Some(sha1_of_file(&dentry.path())?);
|
let data = sha1_of_file(&dentry.path()).map_err(|e| AnkiError::IOError {
|
||||||
|
info: format!("unable to read {}: {}", fname, e),
|
||||||
|
})?;
|
||||||
|
let sha1 = Some(data);
|
||||||
added_or_changed.push(FilesystemEntry {
|
added_or_changed.push(FilesystemEntry {
|
||||||
fname: fname.to_string(),
|
fname: fname.to_string(),
|
||||||
sha1,
|
sha1,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::err::Result;
|
use crate::err::{AnkiError, Result};
|
||||||
use crate::log::{debug, Logger};
|
use crate::log::{debug, Logger};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
@ -402,7 +402,9 @@ pub(super) fn data_for_file(media_folder: &Path, fname: &str) -> Result<Option<V
|
||||||
if e.kind() == io::ErrorKind::NotFound {
|
if e.kind() == io::ErrorKind::NotFound {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
} else {
|
} else {
|
||||||
return Err(e.into());
|
return Err(AnkiError::IOError {
|
||||||
|
info: format!("unable to read {}: {}", fname, e),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue