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

@@ -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::NotFoundException(None));
return Err(Exceptions::notFoundEmpty());
}
Ok(results)
}

View File

@@ -53,7 +53,7 @@ impl<'a> MultiDetector<'_> {
let infos = finder.findMulti(hints)?;
if infos.is_empty() {
return Err(Exceptions::NotFoundException(None));
return Err(Exceptions::notFoundEmpty());
}
let mut result = Vec::new();

View File

@@ -93,9 +93,9 @@ impl<'a> MultiFinderPatternFinder<'_> {
if size < 3 {
// Couldn't find enough finder patterns
return Err(Exceptions::NotFoundException(Some(
return Err(Exceptions::notFound(
"Couldn't find enough finder patterns".to_owned(),
)));
));
}
/*
@@ -212,7 +212,7 @@ impl<'a> MultiFinderPatternFinder<'_> {
if !results.is_empty() {
Ok(results)
} else {
Err(Exceptions::NotFoundException(None))
Err(Exceptions::notFoundEmpty())
}
}

View File

@@ -111,7 +111,7 @@ impl MultipleBarcodeReader for QRCodeMultiReader {
// ignore and continue
continue;
} else {
return Err(output.err().unwrap_or(Exceptions::NotFoundException(None)));
return Err(output.err().unwrap_or(Exceptions::notFoundEmpty()));
}
}