Exit codes#
Every hmp verb maps its outcome to a typed exit code defined
in hydromodpy/cli/helpers.py. The same mapping powers
exit_code_for(exc), which routes Python exceptions to the matching
code. Scripts and CI gates can rely on the table below; new failure
categories will reuse codes 10..19 before introducing new ranges.
Code |
Name |
Meaning |
|---|---|---|
0 |
|
Success. |
1 |
|
Generic failure with no specific mapping. |
2 |
|
Invalid CLI usage (argparse rejected the call). |
10 |
|
Missing file, workspace, simulation, or catalog row.
Raised for |
11 |
|
Catalog or lockfile schema does not match the running version. |
12 |
|
Concurrent writer detected on the catalog or workspace. |
13 |
|
Target opened read-only; the mutation was refused. |
14 |
|
Invalid or missing TOML / Pydantic configuration. |
15 |
|
Solver (MODFLOW 6, MODFLOW-NWT, Boussinesq, GR4J) failed. |
16 |
|
Data validation failed (units, ranges, schema constraints). |
17 |
|
Operation crossed project boundaries (forbidden). |
18 |
|
Required backup step failed during a destructive action. |
19 |
|
Workspace or catalog migration failed. |
130 |
|
Interrupted by |
Exception mapping#
hydromodpy.cli.helpers.exit_code_for(exc) returns the typed code
for an exception instance. KeyboardInterrupt always maps to 130;
FileNotFoundError maps to 10. Domain exceptions defined in
hydromodpy.core.exceptions (SchemaVersionMismatchError,
WriteConflictError, ReadOnlyError, ConfigError,
ConfigMissingError, SolverError, DataError,
CrossProjectsError, BackupFailedError, MigrationFailedError)
map to codes 11..19 respectively. Any other exception falls back to
EXIT_GENERIC (1).