refactor to use exception helper factories

This commit is contained in:
Vukašin Stepanović
2023-02-15 10:46:13 +00:00
parent 3e27279dc8
commit 722ce78fd0
132 changed files with 966 additions and 1132 deletions

View File

@@ -127,7 +127,7 @@ impl LuminanceSource for RGBLuminanceSource {
height,
) {
Ok(crop) => Ok(Box::new(crop)),
Err(_error) => Err(Exceptions::UnsupportedOperationException(None)),
Err(_error) => Err(Exceptions::unsupportedOperationEmpty()),
}
}
@@ -179,9 +179,9 @@ impl RGBLuminanceSource {
height: usize,
) -> Result<Self, Exceptions> {
if left + width > data_width || top + height > data_height {
return Err(Exceptions::IllegalArgumentException(Some(
return Err(Exceptions::illegalArgument(
"Crop rectangle does not fit within image data.".to_owned(),
)));
));
}
Ok(Self {
luminances: pixels.to_owned(),