mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
refactor to use exception helper factories
This commit is contained in:
@@ -87,7 +87,7 @@ impl UPCEANExtension5Support {
|
||||
)?;
|
||||
resultString.push(
|
||||
char::from_u32('0' as u32 + bestMatch as u32 % 10)
|
||||
.ok_or(Exceptions::ParseException(None))?,
|
||||
.ok_or(Exceptions::parseEmpty())?,
|
||||
);
|
||||
|
||||
rowOffset += counters.iter().sum::<u32>() as usize;
|
||||
@@ -105,15 +105,14 @@ impl UPCEANExtension5Support {
|
||||
}
|
||||
|
||||
if resultString.chars().count() != 5 {
|
||||
return Err(Exceptions::NotFoundException(None));
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
}
|
||||
|
||||
let checkDigit = Self::determineCheckDigit(lgPatternFound)?;
|
||||
if Self::extensionChecksum(resultString)
|
||||
.ok_or(Exceptions::IllegalArgumentException(None))?
|
||||
if Self::extensionChecksum(resultString).ok_or(Exceptions::illegalArgumentEmpty())?
|
||||
!= checkDigit as u32
|
||||
{
|
||||
return Err(Exceptions::NotFoundException(None));
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
}
|
||||
|
||||
Ok(rowOffset as u32)
|
||||
@@ -148,7 +147,7 @@ impl UPCEANExtension5Support {
|
||||
return Ok(d);
|
||||
}
|
||||
}
|
||||
Err(Exceptions::NotFoundException(None))
|
||||
Err(Exceptions::notFoundEmpty())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user