mirror of
https://github.com/etesync/server
synced 2024-11-29 12:08:07 +00:00
Use ValidationError when appropriate.
This commit is contained in:
parent
f0a8689712
commit
7714148807
@ -285,7 +285,7 @@ def process_revisions_for_item(item: models.CollectionItem, revision_data: Colle
|
|||||||
chunk_obj.chunkFile.save("IGNORED", ContentFile(content))
|
chunk_obj.chunkFile.save("IGNORED", ContentFile(content))
|
||||||
chunk_obj.save()
|
chunk_obj.save()
|
||||||
else:
|
else:
|
||||||
raise HttpError("chunk_no_content", "Tried to create a new chunk without content")
|
raise ValidationError("chunk_no_content", "Tried to create a new chunk without content")
|
||||||
|
|
||||||
chunks_objs.append(chunk_obj)
|
chunks_objs.append(chunk_obj)
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ def process_revisions_for_item(item: models.CollectionItem, revision_data: Colle
|
|||||||
def _create(data: CollectionIn, user: User):
|
def _create(data: CollectionIn, user: User):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
if data.item.etag is not None:
|
if data.item.etag is not None:
|
||||||
raise HttpError("bad_etag", "etag is not null")
|
raise ValidationError("bad_etag", "etag is not null")
|
||||||
instance = models.Collection(uid=data.item.uid, owner=user)
|
instance = models.Collection(uid=data.item.uid, owner=user)
|
||||||
try:
|
try:
|
||||||
instance.validate_unique()
|
instance.validate_unique()
|
||||||
|
Loading…
Reference in New Issue
Block a user