From 4c3848ceeac2af9df39f18b9e0734458af1990c9 Mon Sep 17 00:00:00 2001 From: dev4 Date: Thu, 18 Sep 2025 20:13:35 +0000 Subject: [PATCH] =?UTF-8?q?fix(idnot):=20renvoyer=204xx=20pour=20erreurs?= =?UTF-8?q?=20m=C3=A9tier=20(pas=20502)=20|=20ci:=20docker=5Ftag=3Dext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/idnot.controller.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/controllers/idnot.controller.ts b/src/controllers/idnot.controller.ts index ff84d8b..6ba6f40 100644 --- a/src/controllers/idnot.controller.ts +++ b/src/controllers/idnot.controller.ts @@ -4,7 +4,7 @@ import { IdNotService } from '../services/idnot'; import { authTokens } from '../utils/auth-tokens'; import { IdNotUser, AuthToken } from '../types'; import { Logger } from '../utils/logger'; -import { NotFoundError, ExternalServiceError, BusinessRuleError, UnauthorizedError, ForbiddenError } from '../types/errors'; +import { NotFoundError, ExternalServiceError, BusinessRuleError, UnauthorizedError, ForbiddenError, ValidationError } from '../types/errors'; /** * Pure controller methods that handle business logic @@ -173,7 +173,13 @@ export class IdNotController { error: error instanceof Error ? error.message : 'Unknown error' }); - if (error instanceof BusinessRuleError || error instanceof ExternalServiceError) { + // Laisser passer les erreurs applicatives connues (4xx) pour éviter un 502 côté client + if ( + error instanceof BusinessRuleError || + error instanceof ForbiddenError || + error instanceof UnauthorizedError || + error instanceof ValidationError + ) { throw error; }