Skip to main content

Exit codes

CodeMeaning
0Success
1API error (4xx or 5xx response)
2Authentication error
3Validation error, including an invalid command line (unknown command or flag, missing argument)
4Schema error
5Internal error

API, authentication and validation errors come out as a JSON object {"error": {"code": …, "message": …}}. A command line that makes no sense (unknown command or flag) comes out as text, on stderr, with code 3.

if ! kobana billing invoices get "$ID" > fatura.json; then
case $? in
1) echo "The API rejected the request" ;;
2) echo "Sign in again: kobana billing auth login" ;;
3) echo "Invalid command or argument" ;;
esac
fi