Commit b861500a authored by Marco Trevisan's avatar Marco Trevisan Committed by Bastien Nocera
Browse files

device: Throw AlreadyInUse error if stopping an enroll during verification

When starting an enroll when verification is in progress (and vice-versa) we
emit an AlreadyInUse error, however when calling VerifyStop() during an
enrollment (and vice-versa) we just return a NoActionInProgress error, which
is not the case.

So let's be consistent and change the error type.
parent 154d0c03
......@@ -960,6 +960,12 @@ static void fprint_device_verify_stop(FprintDevice *rdev,
dbus_g_method_return_error(context, error);
g_error_free (error);
return;
} else if (priv->current_action == ACTION_ENROLL) {
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE,
"Enrollment in progress");
dbus_g_method_return_error(context, error);
g_error_free (error);
return;
}
if (priv->current_cancellable) {
......@@ -1213,8 +1219,17 @@ static void fprint_device_enroll_stop(FprintDevice *rdev,
}
if (priv->current_action != ACTION_ENROLL) {
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_NO_ACTION_IN_PROGRESS,
if (priv->current_action == ACTION_NONE) {
g_set_error (&error, FPRINT_ERROR, FPRINT_ERROR_NO_ACTION_IN_PROGRESS,
"No enrollment in progress");
} else if (priv->current_action == ACTION_VERIFY) {
g_set_error (&error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE,
"Verification in progress");
} else if (priv->current_action == ACTION_IDENTIFY) {
g_set_error (&error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE,
"Identification in progress");
} else
g_assert_not_reached ();
dbus_g_method_return_error(context, error);
g_error_free (error);
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment