Fix for FingerprintPostController

This commit is contained in:
Mal 2020-08-20 23:08:20 +02:00
parent b0f2991346
commit 3cb02a12f1
1 changed files with 3 additions and 5 deletions

View File

@ -17,6 +17,7 @@ final class FingerprintPostController extends AbstractController
$db = new MySqlDatabase();
$json = json_decode($this->requestBody);
$fingerprint = new Fingerprint(null, $db);
$this->response = new ApiJsonResponse();
try {
$fingerprint->setFingerprint($json->fingerprint);
@ -36,13 +37,10 @@ final class FingerprintPostController extends AbstractController
$this->response->setParameter('fingerprintId', $fingerprint->getFingerprintId());
} catch (QrCodeException $e) {
$db->rollback();
$this->response->setParameter('success', false);
$this->response->setStatus(ServerStatus::INTERNAL_ERROR);
$this->response->setMessage('An error occured during qr code creation!');
$this->response->setParameter('success', false);
$this->response->setMessage('An error occured during QR code creation!');
} catch (Throwable $e) {
$db->rollback();
$this->catchDatabaseException($e->getMessage(), $json);
}
}