fix: validation error messages hidden by generic fallback in ErrorHandler::userMessage

ErrorHandler::userMessage only handled RuntimeException, but all validation
throws in ThesisCreateController and ThesisEditController use plain Exception.
This caused user-friendly messages like 'Le champ Nom/Prénom/Pseudo est requis'
to fall through to the 'Une erreur inattendue est survenue…' generic message.

Fix: add Exception check (after PDOException, since PDOException extends it)
so all validation exceptions pass their message through.
This commit is contained in:
Pontoporeia
2026-05-19 00:08:06 +02:00
parent c3f6e8a033
commit df12af8423
6 changed files with 22 additions and 7 deletions
+2 -2
View File
@@ -70,9 +70,9 @@ class ErrorHandler
return self::pdoMessage($e);
}
// ── Validation errors (RuntimeException, InvalidArgumentException) ──
// ── Validation errors (Exception, RuntimeException) ──────────────
// These are thrown with user-friendly French messages — pass through.
if ($e instanceof \RuntimeException) {
if ($e instanceof \Exception) {
return $e->getMessage();
}