improve error printing (show problematic result ID)

This commit is contained in:
eli fessler 2022-11-30 11:05:08 -10:00
parent 63def36e62
commit 470369e298

6
s3s.py
View File

@ -1082,7 +1082,11 @@ def post_result(data, ismonitoring, isblackout, istestrun, overview_data=None):
print(f"* time uploaded: {time_uploaded}; time now: {time_now}")
if postbattle.status_code != 201: # Created (or already exists)
print(f"Error uploading {utils.set_noun(which)[:-1]}. Message from server:")
print(f"Error uploading {utils.set_noun(which)[:-1]}.")
detail_type = "vsHistoryDetail" if which == "ink" else "coopHistoryDetail"
result_id = data["data"][detail_type]["id"]
print(f"{utils.set_noun(which)[:-1].capitalize()} ID: {result_id}")
print("Message from server:")
print(postbattle.content.decode('utf-8'))
elif time_uploaded <= time_now - 5: # give some leeway
print(f"{utils.set_noun(which)[:-1].capitalize()} already uploaded - {headerloc}")