fix(idnot): renvoyer 4xx pour erreurs métier (pas 502) | ci: docker_tag=ext
All checks were successful
build-and-push-ext / build_push (push) Successful in 16s

This commit is contained in:
dev4 2025-09-18 20:13:35 +00:00
parent 0b9aabd046
commit 4c3848ceea

View File

@ -4,7 +4,7 @@ import { IdNotService } from '../services/idnot';
import { authTokens } from '../utils/auth-tokens'; import { authTokens } from '../utils/auth-tokens';
import { IdNotUser, AuthToken } from '../types'; import { IdNotUser, AuthToken } from '../types';
import { Logger } from '../utils/logger'; 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 * Pure controller methods that handle business logic
@ -173,7 +173,13 @@ export class IdNotController {
error: error instanceof Error ? error.message : 'Unknown error' 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; throw error;
} }