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

@@ -92,9 +92,9 @@ pub trait LuminanceSource {
_width: usize,
_height: usize,
) -> Result<Box<dyn LuminanceSource>> {
Err(Exceptions::UnsupportedOperationException(Some(
"This luminance source does not support cropping.".to_owned(),
)))
Err(Exceptions::unsupported_operation_with(
"This luminance source does not support cropping.",
))
}
/**
@@ -119,9 +119,9 @@ pub trait LuminanceSource {
* @return A rotated version of this object.
*/
fn rotateCounterClockwise(&self) -> Result<Box<dyn LuminanceSource>> {
Err(Exceptions::UnsupportedOperationException(Some(
"This luminance source does not support rotation by 90 degrees.".to_owned(),
)))
Err(Exceptions::unsupported_operation_with(
"This luminance source does not support rotation by 90 degrees.",
))
}
/**
@@ -131,9 +131,9 @@ pub trait LuminanceSource {
* @return A rotated version of this object.
*/
fn rotateCounterClockwise45(&self) -> Result<Box<dyn LuminanceSource>> {
Err(Exceptions::UnsupportedOperationException(Some(
"This luminance source does not support rotation by 45 degrees.".to_owned(),
)))
Err(Exceptions::unsupported_operation_with(
"This luminance source does not support rotation by 45 degrees.",
))
}
#[inline(always)]