From 7a23b0ded7656f33268c67fa984a9bd11e0c9f9d Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Tue, 13 May 2025 15:29:39 +0100 Subject: [PATCH] fix: update throw message --- api/src/nlp/controllers/nlp-entity.controller.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/nlp/controllers/nlp-entity.controller.ts b/api/src/nlp/controllers/nlp-entity.controller.ts index 6e439ba5..9f1f2c94 100644 --- a/api/src/nlp/controllers/nlp-entity.controller.ts +++ b/api/src/nlp/controllers/nlp-entity.controller.ts @@ -223,17 +223,17 @@ export class NlpEntityController extends BaseController< throw new BadRequestException('No IDs provided for deletion.'); } - const { count: builtinCount } = await this.filterCount({ + const { count: builtinNlpEntitiesCount } = await this.filterCount({ _id: { $in: ids }, builtin: true, }); - if (builtinCount) { + if (builtinNlpEntitiesCount > 0) { this.logger.warn( `Unable to delete NLP entities with provided IDs: ${ids}`, ); - throw new NotFoundException( - 'Cannot delete builtin NLP entities because at least one is built-in', + throw new MethodNotAllowedException( + 'Deletion failed: Selection includes built-in NLP entities that are protected', ); }