workbench-script.py: server error is provided

This commit is contained in:
pedro 2024-11-11 02:24:06 +01:00
parent 3fb1cd19dc
commit 2d0048433b
1 changed files with 5 additions and 0 deletions

View File

@ -333,6 +333,11 @@ def send_snapshot_to_devicehub(snapshot, token, url, legacy):
print(f"url: {ev_url}") print(f"url: {ev_url}")
else: else:
logger.error(_("Snapshot %s could not be sent to URL '%s'"), snapshot["uuid"], url) logger.error(_("Snapshot %s could not be sent to URL '%s'"), snapshot["uuid"], url)
# TODO review all the try-except thing here; maybe the try inside legacy does not make sense anymore
except urllib.error.HTTPError as e:
error_details = e.read().decode('utf-8') # Get the error response body
logger.error(_("Snapshot %s not remotely sent to URL '%s'. Server responded with error:\n %s"),
snapshot["uuid"], url, error_details)
except Exception as e: except Exception as e:
logger.error(_("Snapshot %s not remotely sent to URL '%s'. Do you have internet? Is your server up & running? Is the url token authorized?\n %s"), snapshot["uuid"], url, e) logger.error(_("Snapshot %s not remotely sent to URL '%s'. Do you have internet? Is your server up & running? Is the url token authorized?\n %s"), snapshot["uuid"], url, e)