From 4564ac3a85f45b7c2f4978702bd61a1cba4d3358 Mon Sep 17 00:00:00 2001 From: gretchen Date: Mon, 18 Nov 2019 17:05:16 -0800 Subject: Handle errors in upload. --- norns_upload | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'norns_upload') 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 -- cgit v1.2.1