mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
Use thiserror for error handling with less boilerplate
This commit is contained in:
@@ -124,7 +124,7 @@ impl<'a> Detector<'_> {
|
||||
|| !self.is_valid(bulls_eye_corners[2])
|
||||
|| !self.is_valid(bulls_eye_corners[3])
|
||||
{
|
||||
return Err(Exceptions::notFoundWith("no valid points"));
|
||||
return Err(Exceptions::not_found_with("no valid points"));
|
||||
}
|
||||
let length = 2 * self.nb_center_layers;
|
||||
// Get the bits around the bull's eye
|
||||
@@ -205,7 +205,7 @@ impl<'a> Detector<'_> {
|
||||
return Ok(shift);
|
||||
}
|
||||
}
|
||||
Err(Exceptions::notFoundWith("rotation failure"))
|
||||
Err(Exceptions::not_found_with("rotation failure"))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,7 +314,7 @@ impl<'a> Detector<'_> {
|
||||
}
|
||||
|
||||
if self.nb_center_layers != 5 && self.nb_center_layers != 7 {
|
||||
return Err(Exceptions::notFound);
|
||||
return Err(Exceptions::NOT_FOUND);
|
||||
}
|
||||
|
||||
self.compact = self.nb_center_layers == 5;
|
||||
|
||||
Reference in New Issue
Block a user