build.py improved error handling
This commit is contained in:
parent
b17ddd2ab0
commit
c5b631df13
15
build.py
15
build.py
@ -89,16 +89,19 @@ def publish_bintray(source, target, env):
|
|||||||
"X-Bintray-Override": "1"
|
"X-Bintray-Override": "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
r = requests.put(
|
r = None
|
||||||
url,
|
|
||||||
|
try:
|
||||||
|
r = requests.put(url,
|
||||||
data=open(firmware_path, "rb"),
|
data=open(firmware_path, "rb"),
|
||||||
headers=headers,
|
headers=headers,
|
||||||
auth=(user,apitoken))
|
auth=(user,apitoken))
|
||||||
|
r.raise_for_status()
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
sys.stderr.write("Failed to submit package: %s\n" %
|
||||||
|
("%s\n%s" % (r.status_code, r.text) if r else str(e)))
|
||||||
|
env.Exit(1)
|
||||||
|
|
||||||
if r.status_code != 201:
|
|
||||||
print("Failed to submit package: {0}\n{1}".format(
|
|
||||||
r.status_code, r.text))
|
|
||||||
else:
|
|
||||||
print("The firmware has been successfuly published at Bintray.com!")
|
print("The firmware has been successfuly published at Bintray.com!")
|
||||||
|
|
||||||
# put build file name and upload command to platformio environment
|
# put build file name and upload command to platformio environment
|
||||||
|
Loading…
Reference in New Issue
Block a user