aboutsummaryrefslogtreecommitdiff
path: root/norns_upload
diff options
context:
space:
mode:
authorgretchen <gretchen@gnar.cool>2019-11-18 17:05:16 -0800
committergretchen <gretchen@gnar.cool>2019-11-18 17:05:16 -0800
commit4564ac3a85f45b7c2f4978702bd61a1cba4d3358 (patch)
tree1db13120d5af689881558baadc3a942ff19565af /norns_upload
parentf40f6e25fe294df19bf09c1e7afbb73bea95a896 (diff)
downloadnorns-etc-4564ac3a85f45b7c2f4978702bd61a1cba4d3358.tar.gz
norns-etc-4564ac3a85f45b7c2f4978702bd61a1cba4d3358.zip
Handle errors in upload.
Diffstat (limited to 'norns_upload')
-rwxr-xr-xnorns_upload9
1 files changed, 6 insertions, 3 deletions
diff --git a/norns_upload b/norns_upload
index c67ea6c..73f34ee 100755
--- a/norns_upload
+++ b/norns_upload
@@ -38,6 +38,9 @@ echo $'\r\n'"--$BOUNDARY--"$'\r\n' >> $TEMP
# thanks monome >:)
curl -XPUT "$DIR_URL" --silent > /dev/null
-# TODO this should exit 1 if this doesn't work
-# looks like we need to parse this.
-curl "$URL" -X PUT -H "Content-Type: multipart/form-data; boundary=$BOUNDARY" --data-binary @$TEMP --compressed --silent > /dev/null
+# all we get is an error message in json if this fails
+RESULT="$(curl "$URL" -X PUT -H "Content-Type: multipart/form-data; boundary=$BOUNDARY" --data-binary @$TEMP --compressed --silent)"
+if jq -e ".error"<<<"$RESULT" >/dev/null; then
+ jq -r ".error" <<<"$RESULT"
+ exit 1
+fi