diff --git a/backend/classes/controller/FingerprintPutController.php b/backend/classes/controller/FingerprintPutController.php index a2123e9..967f3f6 100644 --- a/backend/classes/controller/FingerprintPutController.php +++ b/backend/classes/controller/FingerprintPutController.php @@ -5,6 +5,9 @@ declare(strict_types=1); final class FingerprintPutController extends AbstractController { protected string $route = '/api/v1/fingerprint/{fingerprintId}'; + protected array $mandatoryAttributes = [ + 'fingerprint', + ]; private int $fingerprintId; diff --git a/backend/classes/controller/UserGetController.php b/backend/classes/controller/UserGetController.php index 2ecf056..5364c4e 100644 --- a/backend/classes/controller/UserGetController.php +++ b/backend/classes/controller/UserGetController.php @@ -17,9 +17,15 @@ final class UserGetController extends AbstractController public function handle(): void { - $user = new User($this->userId); + $this->response = new ApiJsonResponse(); - $this->response = new ApiJsonResponse(); - $this->response->setResult($user); + try { + $user = new User($this->userId); + $this->response->setResult($user); + } catch (Throwable $e) { + $this->response->setParameter('success', false); + $this->response->setStatus($e->getCode() !== 0 ? $e->getCode() : ServerStatus::INTERNAL_ERROR); + $this->response->setMessage($e->getMessage()); + } } } \ No newline at end of file