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

@@ -54,7 +54,7 @@ impl Reader for PDF417Reader {
) -> Result<crate::RXingResult> {
let result = Self::decode(image, hints, false)?;
if result.is_empty() {
return Err(Exceptions::notFound);
return Err(Exceptions::NOT_FOUND);
}
Ok(result[0].clone())
}
@@ -124,7 +124,7 @@ impl PDF417Reader {
pdf417RXingResultMetadata
.clone()
.downcast::<PDF417RXingResultMetadata>()
.map_err(|_| Exceptions::illegalState)?,
.map_err(|_| Exceptions::ILLEGAL_STATE)?,
);
result.putMetadata(RXingResultMetadataType::PDF417_EXTRA_METADATA, data);
}