Exceptions¶
opake.exceptions provides stable semantic categories for handling failures
from public Opake APIs:
from opake.exceptions import CalibrationError, CheckpointError, ConfigurationError
try:
result = calibrate(...)
except CalibrationError:
# Use different search bounds or inspect the process definition.
...
except ConfigurationError:
# Correct an invalid or incompatible user option.
...
except CheckpointError:
# Do not resume until the complete DP checkpoint is available.
...
| Exception | Common error family | Use it for |
|---|---|---|
OpakeError |
Exception |
Handling any semantic Opake failure. |
ConfigurationError |
ValueError |
Invalid values, incompatible options, and unsupported user configuration. |
CalibrationError |
ConfigurationError |
Invalid or unsatisfied privacy-calibration searches. |
PrivacyBudgetError |
ConfigurationError |
Invalid privacy-budget definitions. |
InputTypeError |
TypeError |
Arguments whose Python type cannot satisfy an Opake API contract. |
OperationError |
RuntimeError |
An Opake operation that cannot complete in its current state. |
CheckpointError |
OperationError |
Saving, restoring, or resuming an incompatible or incomplete Opake checkpoint. |
Standard Python and third-party errors still surface when they are more specific, such as an I/O failure while opening a caller-provided path.
exceptions
¶
Public semantic exception taxonomy for Opake.
Import these types when application code needs to handle stable categories of
Opake failures. They preserve familiar Python error relationships:
configuration, calibration, and privacy-budget errors are ValueError
subclasses, while checkpoint failures are RuntimeError subclasses.
CalibrationError
¶
Bases: ConfigurationError
Raised when privacy calibration cannot validate or satisfy its search.
Source code in packages/opake-base/src/opake/api/base/exceptions/__init__.py
CheckpointError
¶
Bases: OperationError
Raised when an Opake checkpoint cannot be saved, restored, or resumed.
Source code in packages/opake-base/src/opake/api/base/exceptions/__init__.py
ConfigurationError
¶
Bases: OpakeError, ValueError
Raised when an Opake API receives invalid or incompatible configuration.
Source code in packages/opake-base/src/opake/api/base/exceptions/__init__.py
InputTypeError
¶
Bases: OpakeError, TypeError
Raised when an Opake API receives an argument of an invalid type.
Source code in packages/opake-base/src/opake/api/base/exceptions/__init__.py
OpakeError
¶
Bases: Exception
Base class for failures reported by Opake public APIs.
Source code in packages/opake-base/src/opake/api/base/exceptions/__init__.py
raise_(message, *, cause=None, suppress_context=False)
classmethod
¶
Raise this category with a diagnostic message.
Source code in packages/opake-base/src/opake/api/base/exceptions/__init__.py
OperationError
¶
Bases: OpakeError, RuntimeError
Raised when an Opake operation cannot complete its requested work.
Source code in packages/opake-base/src/opake/api/base/exceptions/__init__.py
PrivacyBudgetError
¶
Bases: ConfigurationError
Raised when a privacy-budget definition or operation is invalid.