fix: update throw message

This commit is contained in:
yassinedorbozgithub 2025-05-13 15:29:39 +01:00
parent ab30c46d97
commit 7a23b0ded7

View File

@ -223,17 +223,17 @@ export class NlpEntityController extends BaseController<
throw new BadRequestException('No IDs provided for deletion.'); throw new BadRequestException('No IDs provided for deletion.');
} }
const { count: builtinCount } = await this.filterCount({ const { count: builtinNlpEntitiesCount } = await this.filterCount({
_id: { $in: ids }, _id: { $in: ids },
builtin: true, builtin: true,
}); });
if (builtinCount) { if (builtinNlpEntitiesCount > 0) {
this.logger.warn( this.logger.warn(
`Unable to delete NLP entities with provided IDs: ${ids}`, `Unable to delete NLP entities with provided IDs: ${ids}`,
); );
throw new NotFoundException( throw new MethodNotAllowedException(
'Cannot delete builtin NLP entities because at least one is built-in', 'Deletion failed: Selection includes built-in NLP entities that are protected',
); );
} }