55 lines
1.2 KiB
Python
55 lines
1.2 KiB
Python
|
|
"""Typed errors with stable exit codes for the CLI.
|
||
|
|
|
||
|
|
Exit codes are part of the contract so callers (ops-warden, CI) can branch on
|
||
|
|
outcome without parsing text.
|
||
|
|
"""
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
|
||
|
|
class SecretsEngineError(Exception):
|
||
|
|
"""Base class. ``exit_code`` is the process exit status."""
|
||
|
|
|
||
|
|
exit_code = 1
|
||
|
|
|
||
|
|
|
||
|
|
class CatalogError(SecretsEngineError):
|
||
|
|
"""Catalog file missing, unparseable, or schema-invalid."""
|
||
|
|
|
||
|
|
exit_code = 2
|
||
|
|
|
||
|
|
|
||
|
|
class DecisionError(SecretsEngineError):
|
||
|
|
"""Decision/CCR missing, denied, superseded, stale, or unapproved."""
|
||
|
|
|
||
|
|
exit_code = 3
|
||
|
|
|
||
|
|
|
||
|
|
class PolicyGuardError(SecretsEngineError):
|
||
|
|
"""A plan violates a safety guard (wildcard, out-of-stage path, root, ...)."""
|
||
|
|
|
||
|
|
exit_code = 4
|
||
|
|
|
||
|
|
|
||
|
|
class BackendError(SecretsEngineError):
|
||
|
|
"""OpenBao backend call failed or is unreachable."""
|
||
|
|
|
||
|
|
exit_code = 5
|
||
|
|
|
||
|
|
|
||
|
|
class ProvisioningError(SecretsEngineError):
|
||
|
|
"""Provisioning input invalid (bad file mode, inside repo, missing field)."""
|
||
|
|
|
||
|
|
exit_code = 6
|
||
|
|
|
||
|
|
|
||
|
|
class VerificationError(SecretsEngineError):
|
||
|
|
"""A verification check did not produce the expected result."""
|
||
|
|
|
||
|
|
exit_code = 7
|
||
|
|
|
||
|
|
|
||
|
|
class DeliveryError(SecretsEngineError):
|
||
|
|
"""Exec-time delivery could not be set up safely."""
|
||
|
|
|
||
|
|
exit_code = 8
|