added more logs in case of error

This commit is contained in:
Amazed 2021-12-23 22:59:39 +01:00
parent ba70cdac89
commit 6802b12abb

10
main.py
View File

@ -208,7 +208,7 @@ class MapsBackground(QThread):
self.log(f"Error while fetching map info: {e}")
return
if req.status_code != 200:
self.log(f"Could not download map from server, got status_code {req.status_code}")
self.log(f"Could not download map from server, got status_code {req.status_code}: {req.text}")
return
j = req.json()
blob_location = j["blob_location"]
@ -250,10 +250,16 @@ class MapsBackground(QThread):
map_data = {"name": map_name, "b64_data": b64_data}
try:
req = requests.post(f"{API_BASE_URL}/maps", json=map_data)
except Exception as e:
self.log(f"There was an error while uploading map: {e} {req.text}")
return
try:
req.raise_for_status()
except Exception as e:
self.log(f"There was an error while uploading map: {e}")
self.log(f"There was an error while uploading map: {e} {req.text}")
return
self.log("Upload successful")
def all_servers_download(self) -> None: