From 6ecc99a6e3d3708981fa3de5c01d1cfcf7bfe486 Mon Sep 17 00:00:00 2001 From: "patrick.brugiere" Date: Tue, 21 Nov 2023 16:54:55 +0100 Subject: [PATCH 1/2] modification de certain catch new exception et ajout d'un pour les liste trop courte pour le quiz --- Project/php/controller/UserController.php | 2 +- Project/php/controller/VisitorController.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Project/php/controller/UserController.php b/Project/php/controller/UserController.php index 9829443..1d4e89f 100755 --- a/Project/php/controller/UserController.php +++ b/Project/php/controller/UserController.php @@ -50,7 +50,7 @@ class UserController extends VisitorController $this->showAccountInfos(); } catch (Exception $e){ - throw new Exception("invalid entries"); + throw new Exception("invalid entries". $e->getMessage()); } } diff --git a/Project/php/controller/VisitorController.php b/Project/php/controller/VisitorController.php index 8f155a3..b6c646a 100755 --- a/Project/php/controller/VisitorController.php +++ b/Project/php/controller/VisitorController.php @@ -5,6 +5,7 @@ namespace controller; use config\Validation; use gateway\TranslationGateway; use gateway\VocabularyListGateway; +use http\Message; use model\MdlUser; use Exception; @@ -54,7 +55,7 @@ class VisitorController } catch (Exception $e){ - throw new Exception("Erreur"); + throw new Exception($e->getMessage()); } } public function quiz($match): void @@ -85,7 +86,9 @@ class VisitorController for ($i = 0; $i < count($questions); $i++) { $correctAnswer = $allTranslation[$i]->getWord2(); array_splice($allEnglishWords, array_search($correctAnswer, $allEnglishWords), 1); - + if(count($allEnglishWords) < 3) { + throw new Exception("pas assez de vocabulaire"); + } $tab = array_rand(array_flip($allEnglishWords), 3); array_push($allEnglishWords, $correctAnswer); @@ -112,7 +115,7 @@ class VisitorController } } catch (Exception $e){ - throw new Exception("Erreur"); + throw new Exception($e->getMessage()); } } From 44c1f06f1ce4eff861b8efc22af309363282cc4e Mon Sep 17 00:00:00 2001 From: "patrick.brugiere" Date: Tue, 21 Nov 2023 17:33:15 +0100 Subject: [PATCH 2/2] modif de la vue d erreur --- Project/php/templates/erreur.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Project/php/templates/erreur.html b/Project/php/templates/erreur.html index a3f9ccf..e613f7e 100755 --- a/Project/php/templates/erreur.html +++ b/Project/php/templates/erreur.html @@ -32,6 +32,7 @@ flex-direction: column; background-size: cover; /* Ajuster la taille de l'image pour couvrir tout le corps */ background-position: center; + overflow: hidden; } .err{ justify-content:center; @@ -54,7 +55,8 @@ -
+ {% include 'navBar.twig' %} +

ERREUR

{% if dVueEreur is defined %} {% for value in dVueEreur %}