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

@@ -70,9 +70,7 @@ impl BitSource {
*/
pub fn readBits(&mut self, numBits: usize) -> Result<u32, Exceptions> {
if !(1..=32).contains(&numBits) || numBits > self.available() {
return Err(Exceptions::IllegalArgumentException(Some(
numBits.to_string(),
)));
return Err(Exceptions::illegalArgument(numBits.to_string()));
}
let mut result: u32 = 0;