Fix image errors

* Firstly only log one error per image load, not per frame
* Secondly use an Icon not an image for rendering Icons
This commit is contained in:
Conrad Irwin 2023-11-17 13:45:05 -07:00
parent ceb20dea96
commit 6bfe6fa0e1
3 changed files with 17 additions and 10 deletions

View file

@ -2,7 +2,7 @@ use crate::{ImageData, ImageId, SharedString};
use collections::HashMap;
use futures::{
future::{BoxFuture, Shared},
AsyncReadExt, FutureExt,
AsyncReadExt, FutureExt, TryFutureExt,
};
use image::ImageError;
use parking_lot::Mutex;
@ -88,6 +88,14 @@ impl ImageCache {
Ok(Arc::new(ImageData::new(image)))
}
}
.map_err({
let uri = uri.clone();
move |error| {
log::log!(log::Level::Error, "{:?} {:?}", &uri, &error);
error
}
})
.boxed()
.shared();