Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ RESPONSE=$(curl -X $METHOD https://api.rollbar.com/api/1/deploy/$DEPLOY_ID \
--form rollbar_username=$ROLLBAR_USERNAME \
--form local_username=$LOCAL_USERNAME)

# If error code is not zero something failed
ERROR_CODE=$(echo $RESPONSE | jq -r '.err')
if [[ $ERROR_CODE -ne 0 ]]; then
ERROR_MESSAGE=$(echo $RESPONSE | jq -r '.message')
echo $ERROR_MESSAGE
exit 1
fi

# Get the deploy id depending on the response as they are different for POST and PATCH
if [[ $METHOD == "POST" ]]; then
ROLLBAR_DEPLOY_ID=$(echo $RESPONSE | jq -r '.data.deploy_id')
Expand All @@ -49,6 +57,7 @@ fi

# If not ROLLBAR_DEPLOY_ID something failed
if [[ "$ROLLBAR_DEPLOY_ID" == "null" ]]; then
echo "deploy_id not available"
exit 1
fi

Expand Down