mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 15:51:23 +01:00
rename Error::Image to Error::GenerateThumbnail
The previous error was nonspecific and, because of the '#[from]' annotation, could have been used accidentally for *any* errors from the image crate.
This commit is contained in:
parent
ed7f7b2461
commit
05043f97a0
2 changed files with 8 additions and 9 deletions
|
|
@ -276,10 +276,12 @@ impl Service {
|
||||||
|
|
||||||
t::debug!("Serializing thumbnail as PNG");
|
t::debug!("Serializing thumbnail as PNG");
|
||||||
let mut thumbnail_bytes = Vec::new();
|
let mut thumbnail_bytes = Vec::new();
|
||||||
thumbnail.write_to(
|
thumbnail
|
||||||
|
.write_to(
|
||||||
&mut Cursor::new(&mut thumbnail_bytes),
|
&mut Cursor::new(&mut thumbnail_bytes),
|
||||||
image::ImageFormat::Png,
|
image::ImageFormat::Png,
|
||||||
)?;
|
)
|
||||||
|
.map_err(Error::GenerateThumbnail)?;
|
||||||
|
|
||||||
Ok(Some(thumbnail_bytes))
|
Ok(Some(thumbnail_bytes))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,8 @@ pub(crate) enum Error {
|
||||||
#[from]
|
#[from]
|
||||||
source: rocksdb::Error,
|
source: rocksdb::Error,
|
||||||
},
|
},
|
||||||
#[error("Could not generate an image.")]
|
#[error("Could not generate image thumbnail.")]
|
||||||
Image {
|
GenerateThumbnail(#[source] image::error::ImageError),
|
||||||
#[from]
|
|
||||||
source: image::error::ImageError,
|
|
||||||
},
|
|
||||||
#[error("Could not connect to server: {source}")]
|
#[error("Could not connect to server: {source}")]
|
||||||
Reqwest {
|
Reqwest {
|
||||||
#[from]
|
#[from]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue