Skip to content

Commit b451725

Browse files
committed
Improve error reporting in metadata update
Enhances the ValueError raised in _update_single_metadata to include detailed error messages from the response, improving debugging and user feedback.
1 parent d96f962 commit b451725

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

dvuploader/nativeupload.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,16 @@ async def _update_single_metadata(
459459
else:
460460
await asyncio.sleep(1.0)
461461

462-
raise ValueError(f"Failed to update metadata for file {file.file_name}.")
462+
if "message" in response.json():
463+
# If the response is a JSON object, we can get the error message from the "message" key.
464+
error_message = response.json()["message"]
465+
else:
466+
# If the response is not a JSON object, we can get the error message from the response text.
467+
error_message = response.text
468+
469+
raise ValueError(
470+
f"Failed to update metadata for file {file.file_name}: {error_message}"
471+
)
463472

464473

465474
def _retrieve_file_ids(

0 commit comments

Comments
 (0)