fix: print error on failed to read metadata
this should be very rare, so no need to display it or abort
This commit is contained in:
parent
808a8bf31d
commit
1f909904c2
1 changed files with 7 additions and 5 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -194,11 +194,13 @@ impl State {
|
|||
path.as_ref()
|
||||
.file_name()
|
||||
.map_or(Cow::Borrowed("[no file]"), OsStr::to_string_lossy),
|
||||
path.as_ref()
|
||||
.metadata()
|
||||
.map_or(Cow::Borrowed("[no size]"), |m| Cow::Owned(
|
||||
Size::from_bytes(m.size()).to_string()
|
||||
)),
|
||||
path.as_ref().metadata().map_or_else(
|
||||
|e| {
|
||||
eprintln!("failed to read metadata: {e}");
|
||||
Cow::Borrowed("[no size]")
|
||||
},
|
||||
|m| Cow::Owned(Size::from_bytes(m.size()).to_string())
|
||||
),
|
||||
image.width(),
|
||||
image.height(),
|
||||
));
|
||||
|
|
|
|||
Loading…
Reference in a new issue