Skip to content

Commit

Permalink
add better logging to platformio_upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikN committed Aug 21, 2023
1 parent 06f7605 commit eb82417
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion platformio_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ def on_upload(source, target, env):

response = requests.post(upload_url, data=monitor, headers={'Content-Type': monitor.content_type})
bar.close()
print(response,response.text)

# Basic error checking
if response.status_code != 200 or 'error' in response.text.lower(): # This assumes that the response contains the word "error" in case of failures
raise Exception(f"Upload failed with status {response.status_code}: {response.text}")
else:
print("Upload completed successfully!")
print(response.text)


env.Replace(UPLOADCMD=on_upload)

0 comments on commit eb82417

Please sign in to comment.