[TECH] Sortir les erreurs jetées dans les repositories de certification/enrolment (PIX-23893). - #17144
Open
alexandrecoin wants to merge 5 commits into
Open
Conversation
|
Choisir les applications à déployer :
Important N'oubliez pas de déployer l'API pour pouvoir accéder aux fronts et/ou à l’API MaDDo. |
alexandrecoin
force-pushed
the
pix-23893-remove-thrown-error-from-enrolment-repositories
branch
from
August 14, 2026 13:34
6aa700c to
2247125
Compare
yaf
approved these changes
Aug 14, 2026
alexandrecoin
force-pushed
the
pix-23893-remove-thrown-error-from-enrolment-repositories
branch
from
August 14, 2026 13:44
85ad1cc to
ff24b7b
Compare
…y.update method It is unnecessarry to check whether the candidate exists or not as this is already done where candidate-repository.update is called (be it usecases or services)
…tendance-sheet-repository getWithCertificationCandidates
- Different calls from sessionAuthorizationAdapter.find already return null if no session is found - As these calls are made before sessionRepository.get in all the usecases modified in this commit we check on missing session beforehand to throw a NotFoundError - Note: some sessionRepository.get calls are made directly from controllers, we return 404 error codes instead of mapped domain errors. This choice prevents any additional information to be returned from the route call
Co-authored-by: Claude <claude@anthropic.com>
alexandrecoin
force-pushed
the
pix-23893-remove-thrown-error-from-enrolment-repositories
branch
from
August 14, 2026 14:21
ff24b7b to
8688229
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
☀️ Problème
Plusieurs repositories du sous-contexte
certification/enrolmentlèvent des erreurs du domaine lorsqu'ils ne trouvent pas de ligne en base.L'infrastructure porte ainsi une décision métier alors que son seul rôle devrait être de rapporter ce qu'elle a trouvé, ou non.
⛱️ Proposition
Les repositories renvoient désormais
nullau lieu de lever une erreur, et la décision métier remonte d'un cran :Repositories (
enrolment/infrastructure)session-repositorygetthrow NotFoundErrorreturn nullsession-repositoryremovethrow NotFoundErrorreturn nullsession-for-attendance-sheet-repositorygetWithCertificationCandidatesthrow NotFoundErrorreturn nullcandidate-repositoryupdatethrow CertificationCandidateNotFoundError🧴 Remarques
Le refacto porte uniquement sur
certification/enrolmentunfinalize-sessionintroduit un changement de comportement, pas seulement un déplacement d'erreur : finalizedSessionRepository.remove (dans session-management, non touché par la branche) n'a jamais levé d'erreur. Avant, dé-finaliser une session absente de finalized-sessions passait silencieusement et appelait quand même sessionManagementRepository.unfinalize.GET/PATCHd'une session inexistante, le 404 n'est plus produit par l'error-managermais directement par le contrôleur. Le statut est identique, mais le corps de la réponse n'est plus un payload d'erreur JSON:API. (Renvoi d'un statusCode 404 au lieu d'une erreur)🏊 Pour tester
enrolment:GET/PATCHd'une session inexistante →404404404404404404