Implement #570, special error code for missing

This commit is contained in:
boltgolt 2023-02-18 21:41:20 +01:00
parent 72c1086870
commit cd890b56c1
No known key found for this signature in database
GPG key ID: BECEC9937E1AAE26
4 changed files with 8 additions and 4 deletions

View file

@ -79,6 +79,9 @@ auto howdy_error(int status,
conv_function(PAM_ERROR_MSG, S("Face detection image too dark")); conv_function(PAM_ERROR_MSG, S("Face detection image too dark"));
syslog(LOG_ERR, "Failure, image too dark"); syslog(LOG_ERR, "Failure, image too dark");
break; break;
case CompareError::INVALID_DEVICE:
syslog(LOG_ERR, "Failure, not possible to open camera at configured path");
break;
default: default:
conv_function(PAM_ERROR_MSG, conv_function(PAM_ERROR_MSG,
std::string(S("Unknown error: ") + status).c_str()); std::string(S("Unknown error: ") + status).c_str());

View file

@ -13,7 +13,8 @@ enum CompareError : int {
TIMEOUT_REACHED = 11, TIMEOUT_REACHED = 11,
ABORT = 12, ABORT = 12,
TOO_DARK = 13, TOO_DARK = 13,
TIMEOUT_ACTIVE = 2816, INVALID_DEVICE = 14,
TIMEOUT_ACTIVE = 2816
}; };
inline auto get_workaround(const std::string &workaround) -> Workaround { inline auto get_workaround(const std::string &workaround) -> Workaround {

View file

@ -27,7 +27,7 @@ public:
template <typename T> template <typename T>
optional_task<T>::optional_task(std::function<T()> func) optional_task<T>::optional_task(std::function<T()> func)
: task(std::packaged_task<T()>(std::move(func))), future(task.get_future()), : task(std::packaged_task<T()>(std::move(func))), future(task.get_future()),
spawned(false), is_active(false) {} spawned(), is_active() {}
// Create a new thread and launch the task on it. // Create a new thread and launch the task on it.
template <typename T> void optional_task<T>::activate() { template <typename T> void optional_task<T>::activate() {

View file

@ -37,7 +37,7 @@ class VideoCapture:
print(_("Howdy could not find a camera device at the path specified in the config file.")) print(_("Howdy could not find a camera device at the path specified in the config file."))
print(_("It is very likely that the path is not configured correctly, please edit the 'device_path' config value by running:")) print(_("It is very likely that the path is not configured correctly, please edit the 'device_path' config value by running:"))
print("\n\tsudo howdy config\n") print("\n\tsudo howdy config\n")
sys.exit(1) sys.exit(14)
# Create reader # Create reader
# The internal video recorder # The internal video recorder
@ -83,7 +83,7 @@ class VideoCapture:
ret, frame = self.internal.read() ret, frame = self.internal.read()
if not ret: if not ret:
print(_("Failed to read camera specified in the 'device_path' config option, aborting")) print(_("Failed to read camera specified in the 'device_path' config option, aborting"))
sys.exit(1) sys.exit(14)
try: try:
# Convert from color to grayscale # Convert from color to grayscale