Skip to content

Commit

Permalink
fetch.sh: add error handling when API returns an error object.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicah committed May 7, 2023
1 parent 6c944db commit 2c37e0d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ do
# This means that we've passed the end and reached an empty array
break
fi
if [ $(echo $json | jq 'objects // {} | has("message")') == "true" ]; then
# API has return an error object
echo "Unable to fetch releases from GitHub API"
exit 2
fi
# Store array of revisions
revisions=($(echo $json | jq -e -r ".[] | .html_url | select(contains(\"$PACKAGE_NAME\") and contains(\"$HAIKU_ARCH_SUFFIX\"))[${#releaseUrl}:]")) \
|| continue
Expand Down

0 comments on commit 2c37e0d

Please sign in to comment.