From 4592bd356051b04d775039d0b047a2fcccaf6f3b Mon Sep 17 00:00:00 2001 From: SFDKHISSI Date: Fri, 2 Feb 2024 11:59:55 +0100 Subject: [PATCH] remade the error throwing for already existing user --- src/Service/AccountService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/AccountService.php b/src/Service/AccountService.php index 87db474..8871ba2 100755 --- a/src/Service/AccountService.php +++ b/src/Service/AccountService.php @@ -64,7 +64,7 @@ public function createAccount(Request $request) // check if the username is already in use $user = $this->userRepository->findOneBy(['username' => $name]); if ($user) { - $error = 'Ce nom d\'utilisateur est déja utilisé.'; + throw new \Exception('Ce nom d\'utilisateur est déja utilisé.'); } else { // create the user $user = new User();