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

@@ -127,9 +127,7 @@ impl<'a> Detector<'_> {
|| !self.is_valid(&bulls_eye_corners[2])
|| !self.is_valid(&bulls_eye_corners[3])
{
return Err(Exceptions::NotFoundException(Some(
"no valid points".to_owned(),
)));
return Err(Exceptions::notFound("no valid points".to_owned()));
}
let length = 2 * self.nb_center_layers;
// Get the bits around the bull's eye
@@ -210,9 +208,7 @@ impl<'a> Detector<'_> {
return Ok(shift);
}
}
Err(Exceptions::NotFoundException(Some(
"rotation failure".to_owned(),
)))
Err(Exceptions::notFound("rotation failure".to_owned()))
}
/**
@@ -324,7 +320,7 @@ impl<'a> Detector<'_> {
}
if self.nb_center_layers != 5 && self.nb_center_layers != 7 {
return Err(Exceptions::NotFoundException(None));
return Err(Exceptions::notFoundEmpty());
}
self.compact = self.nb_center_layers == 5;