mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: update throw message
This commit is contained in:
parent
ab30c46d97
commit
7a23b0ded7
@ -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',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user