Better reporting of errors in PUT requests
This commit is contained in:
parent
e47747d4d4
commit
fe97741f08
@ -797,13 +797,23 @@ class Application:
|
|||||||
tag = tags.get(content_type)
|
tag = tags.get(content_type)
|
||||||
|
|
||||||
if write_whole_collection:
|
if write_whole_collection:
|
||||||
|
try:
|
||||||
new_item = self.Collection.create_collection(
|
new_item = self.Collection.create_collection(
|
||||||
path, items, {"tag": tag})
|
path, items, {"tag": tag})
|
||||||
|
except ValueError as e:
|
||||||
|
self.logger.warning(
|
||||||
|
"Bad PUT request on %r: %s", path, e, exc_info=True)
|
||||||
|
return BAD_REQUEST
|
||||||
else:
|
else:
|
||||||
if tag:
|
if tag:
|
||||||
parent_item.set_meta({"tag": tag})
|
parent_item.set_meta({"tag": tag})
|
||||||
href = posixpath.basename(path.strip("/"))
|
href = posixpath.basename(path.strip("/"))
|
||||||
|
try:
|
||||||
new_item = parent_item.upload(href, items[0])
|
new_item = parent_item.upload(href, items[0])
|
||||||
|
except ValueError as e:
|
||||||
|
self.logger.warning(
|
||||||
|
"Bad PUT request on %r: %s", path, e, exc_info=True)
|
||||||
|
return BAD_REQUEST
|
||||||
headers = {"ETag": new_item.etag}
|
headers = {"ETag": new_item.etag}
|
||||||
return client.CREATED, headers, None
|
return client.CREATED, headers, None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user