mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
Use thiserror for error handling with less boilerplate
This commit is contained in:
@@ -56,7 +56,7 @@ impl<T: Reader> MultipleBarcodeReader for GenericMultipleBarcodeReader<T> {
|
||||
let mut results = Vec::new();
|
||||
self.doDecodeMultiple(image, hints, &mut results, 0, 0, 0);
|
||||
if results.is_empty() {
|
||||
return Err(Exceptions::notFound);
|
||||
return Err(Exceptions::NOT_FOUND);
|
||||
}
|
||||
Ok(results)
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ impl<'a> MultiDetector<'_> {
|
||||
let infos = finder.findMulti(hints)?;
|
||||
|
||||
if infos.is_empty() {
|
||||
return Err(Exceptions::notFound);
|
||||
return Err(Exceptions::NOT_FOUND);
|
||||
}
|
||||
|
||||
let mut result = Vec::new();
|
||||
|
||||
@@ -92,7 +92,7 @@ impl<'a> MultiFinderPatternFinder<'_> {
|
||||
|
||||
if size < 3 {
|
||||
// Couldn't find enough finder patterns
|
||||
return Err(Exceptions::notFoundWith(
|
||||
return Err(Exceptions::not_found_with(
|
||||
"Couldn't find enough finder patterns",
|
||||
));
|
||||
}
|
||||
@@ -212,7 +212,7 @@ impl<'a> MultiFinderPatternFinder<'_> {
|
||||
if !results.is_empty() {
|
||||
Ok(results)
|
||||
} else {
|
||||
Err(Exceptions::notFound)
|
||||
Err(Exceptions::NOT_FOUND)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ impl MultipleBarcodeReader for QRCodeMultiReader {
|
||||
// ignore and continue
|
||||
continue;
|
||||
} else {
|
||||
return Err(output.err().unwrap_or(Exceptions::notFound));
|
||||
return Err(output.err().unwrap_or(Exceptions::NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user