HotCodePush

Exit codes

The five exit codes of the hotcodepush CLI, from 0 for success to 4 for a confirmation that needs --yes, and how a script reads them.

The CLI exits with one of five codes, one per failure class. A script branches on the class and reads the error code for the cause. Under --json the code travels as error.code with the same exit code.

Exit codeClassPrinted as
0doneThe command's output is printed.
1an errorA code of the CLI's own is printed, or an API error passed through.
2a missing or invalid parametermissing_parameter or invalid_parameter is printed.
3not logged innot_logged_in is printed, or an API answer of 401 such as unauthenticated.
4a confirmation required without --yesconfirmation_required is printed.

init and doctor report their outcome in their rows: doctor exits 1 with doctor_failed when a check failed, and init exits 1 when a step stopped, with that step's code under --json.

Reading the codes in a script

Branch on the exit code for the class and on error.code for the cause:

npx hotcodepush release create --yes --json > release.json
case $? in
  0) echo "released" ;;
  2) echo "a flag is missing or wrong" ;;
  3) echo "set HOTCODEPUSH_TOKEN" ;;
  4) echo "pass --yes" ;;
  *) echo "failed: $(cat release.json)" ;;
esac

Ship every commit shows the step that reads them.

Last updated on

On this page