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 code | Class | Printed as |
|---|---|---|
0 | done | The command's output is printed. |
1 | an error | A code of the CLI's own is printed, or an API error passed through. |
2 | a missing or invalid parameter | missing_parameter or invalid_parameter is printed. |
3 | not logged in | not_logged_in is printed, or an API answer of 401 such as unauthenticated. |
4 | a confirmation required without --yes | confirmation_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)" ;;
esacShip every commit shows the step that reads them.
Last updated on