add more docs on the bulk job launch feature

better error message
This commit is contained in:
Nikhil
2023-02-23 10:47:22 +05:30
committed by Elijah DeLee
parent 7cb16ef91d
commit b1af27c4f6
2 changed files with 42 additions and 17 deletions

View File

@@ -2052,7 +2052,7 @@ class BulkHostCreateSerializer(serializers.Serializer):
try:
Host.objects.bulk_create(result)
except Exception as e:
raise serializers.ValidationError({"detail": _(f"{e}")})
raise serializers.ValidationError({"detail": _(f"cannot create host, host creation error {e}")})
new_total_hosts = old_total_hosts + len(result)
request = self.context.get('request', None)
changes = {'total_hosts': [old_total_hosts, new_total_hosts]}