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

@@ -68,7 +68,7 @@ impl GridSampler for DefaultGridSampler {
transform: &PerspectiveTransform,
) -> Result<BitMatrix> {
if dimensionX == 0 || dimensionY == 0 {
return Err(Exceptions::notFound);
return Err(Exceptions::NOT_FOUND);
}
let mut bits = BitMatrix::new(dimensionX, dimensionY)?;
let mut points = vec![0.0; 2 * dimensionX as usize];
@@ -99,7 +99,7 @@ impl GridSampler for DefaultGridSampler {
// }
if image
.try_get(points[x] as u32, points[x + 1] as u32)
.ok_or(Exceptions::notFoundWith(
.ok_or(Exceptions::not_found_with(
"index out of bounds, see documentation in file for explanation",
))?
{