Use thiserror for error handling with less boilerplate

This commit is contained in:
Steve Cook
2023-02-20 09:41:28 -05:00
parent 01e4f4a126
commit f8b29f37db
135 changed files with 868 additions and 905 deletions

View File

@@ -167,7 +167,7 @@ impl PlanarYUVLuminanceSource {
inverted: bool,
) -> Result<Self> {
if left + width > data_width || top + height > data_height {
return Err(Exceptions::illegalArgumentWith(
return Err(Exceptions::illegal_argument_with(
"Crop rectangle does not fit within image data.",
));
}
@@ -329,7 +329,7 @@ impl LuminanceSource for PlanarYUVLuminanceSource {
self.invert,
) {
Ok(new) => Ok(Box::new(new)),
Err(_err) => Err(Exceptions::unsupportedOperation),
Err(_err) => Err(Exceptions::UNSUPPORTED_OPERATION),
}
}