wauth.exceptions module¶
Custom exception hierarchy for WAuth.
Provides a structured hierarchy of exceptions that allow callers to distinguish between different failure modes (key not found, decryption failure, vault corruption, backup errors, etc.).
- exception wauth.exceptions.WAuthError[source]¶
Bases:
ExceptionBase exception for all WAuth-related errors.
All custom exceptions inherit from this class, allowing callers to catch any WAuth-specific error with a single
exceptclause.Example
>>> try: ... auth.get("NONEXISTENT") ... except WAuthError as exc: ... print(f"WAuth error: {exc}")
- exception wauth.exceptions.KeyNotFoundError[source]¶
Bases:
WAuthErrorRaised when a requested secret key does not exist in the vault.
Example
>>> try: ... value = auth.get("MISSING_KEY") ... except KeyNotFoundError: ... print("Key not found")
- exception wauth.exceptions.DecryptionError[source]¶
Bases:
WAuthErrorRaised when decryption fails due to wrong key or corrupted data.
This exception replaces the previous silent-failure behaviour that returned empty bytes (
b"") on decryption errors.Example
>>> try: ... engine.decrypt("invalid-token") ... except DecryptionError: ... print("Cannot decrypt — wrong key or corrupted data")
- exception wauth.exceptions.VaultError[source]¶
Bases:
WAuthErrorRaised when a vault operation fails (database corruption, I/O error).
Example
>>> try: ... vault.save("KEY", "value") ... except VaultError: ... print("Vault storage error")
- exception wauth.exceptions.BackupError[source]¶
Bases:
WAuthErrorRaised when a backup or export operation fails.
Example
>>> try: ... auth.backup("backup.wauth") ... except BackupError: ... print("Backup failed")
- exception wauth.exceptions.RestoreError[source]¶
Bases:
WAuthErrorRaised when a restore or import operation fails.
Example
>>> try: ... auth.restore("backup.wauth") ... except RestoreError: ... print("Restore failed")
- exception wauth.exceptions.RotationError[source]¶
Bases:
WAuthErrorRaised when a key or secret rotation operation fails.
Example
>>> try: ... auth.rotate_key() ... except RotationError: ... print("Key rotation failed")
- exception wauth.exceptions.ConfigurationError[source]¶
Bases:
WAuthErrorRaised when configuration loading or validation fails.
Example
>>> try: ... auth = WAuth(config_path="bad.toml") ... except ConfigurationError: ... print("Invalid configuration file")