Exit codes#
A command ends with the code of its outcome. Codes 0, 1 and 2 keep their usual meaning, 130 is the POSIX code of an interrupted process, and the codes from 10 name the category of the failure. An exception that a command does not catch ends with the code of its class.
| Code | Name | Raised for | Set directly by |
|---|---|---|---|
0 | EXIT_OK | Nothing: the command succeeded. | |
1 | EXIT_GENERIC | Any exception that no other row maps. | 4 commandshmp catalog query, hmp export, hmp publish, hmp doctor |
2 | EXIT_USAGE | - | 19 commandshmp project delete, hmp campaign case, hmp campaign prune, hmp example add, hmp catalog delete, hmp catalog trash, hmp catalog tag, hmp catalog rerun, hmp data remove, hmp data prune, hmp data lock, hmp ls, hmp show, hmp export, hmp publish, hmp run, hmp calibrate, hmp site import, hmp doctor |
10 | EXIT_NOT_FOUND | FileNotFoundError | 32 commandshmp workspace list, hmp workspace clean, hmp project new, hmp project delete, hmp project list, hmp project import, hmp campaign promote, hmp campaign prune, hmp example add, hmp catalog query, hmp catalog gc, hmp catalog watch, hmp data ls, hmp data get, hmp data remove, hmp data prune, hmp data archive, hmp data restore, hmp ls, hmp show, hmp diff, hmp check, hmp publish, hmp run, hmp replay, hmp calibrate, hmp spinup, hmp site add, hmp site import, hmp site ls, hmp site show, hmp doctor |
11 | EXIT_SCHEMA_MISMATCH | - | |
12 | EXIT_WRITE_CONFLICT | FileExistsError | 1 commandshmp project delete |
13 | EXIT_READ_ONLY | - | |
14 | EXIT_CONFIG | - | 13 commandshmp workspace init, hmp workspace clean, hmp project plan, hmp data get, hmp show, hmp check, hmp config, hmp run, hmp calibrate, hmp spinup, hmp site add, hmp doctor, hmp install-binaries |
15 | EXIT_SOLVER_ERROR | - | |
16 | EXIT_VALIDATION | - | 3 commandshmp data get, hmp data lock, hmp diff |
17 | EXIT_CROSS_PROJECTS | - | |
18 | EXIT_BACKUP_FAILED | - | |
19 | EXIT_MIGRATION_FAILED | - | |
20 | EXIT_AMBIGUOUS_REFERENCE | - | |
21 | EXIT_CALIBRATION | - | 2 commandshmp run, hmp calibrate |
22 | EXIT_CATALOG_UNREADABLE | - | |
23 | EXIT_CASES_FAILED | - | 1 commandshmp run |
130 | EXIT_SIGINT | KeyboardInterrupt | 7 commandshmp project delete, hmp campaign prune, hmp catalog delete, hmp catalog trash, hmp data remove, hmp data prune, hmp run |
The code of a failure#
A failure prints one line on stderr that starts with its HMPY.Exxx code: HMPY.E002: File not found: run.toml. Exceptions and error codes lists the classes and their codes. A refusal the command writes itself takes the code of the class of its exit code. HMPY.E000 is a failure with no category of its own, most often a bug of ours. What a program reads says what a failure prints under --format json.
What is promised#
Inside a major version an exit code keeps its number and its meaning, and an HMPY.Exxx code keeps its meaning. A new category comes with a new number, so a program reads a number it does not know as a failure. The words of a message can change in any version, so a program reads the codes and never the words.
Codes each command sets itself#
Read from the code of each command: every refusal and every sys.exit it reaches. A command that is not listed ends with 0, with 1 for an error, or with the code of an uncaught exception.