BioptimusError, tagged with a machine-readable ErrorCode. Low-level code raises the typed error with structured context; this module owns the actionable remediation text for each code. The system boundary (for example the per-slide handler) logs it once with the attached code, so whoever reads the log gets an instant explanation and a direct fix.
Each ErrorCode member carries two pieces of information:
- its value is the stable, dotted support code (for example
"BIO-WSI-001") used in logs, dashboards, and customer communication; and - its name maps to a human-readable
eventslug (for example"wsi_backend_unavailable") viaErrorCode.event.
ErrorCode
event slug through event.
event
"wsi_backend_unavailable".
remediation
remediation_for
None.
BioptimusError
ErrorCode together with structured diagnostic context and an actionable remediation hint. It is designed to be raised at low levels (raise BioptimusError(...) from exc) and logged exactly once at a system boundary.
to_dict
BioptimusValueError
BioptimusError that is also a ValueError.
Raised where the SDK historically raised a plain ValueError (for example an unsupported format or invalid input). Inheriting from both keeps existing except ValueError handlers working while exposing the typed code, context, and remediation.
BioptimusRuntimeError
BioptimusError that is also a RuntimeError.
Raised where the SDK historically raised a plain RuntimeError (for example an unavailable backend or a failed operation). Inheriting from both keeps existing except RuntimeError handlers working while exposing the typed code, context, and remediation.
BioptimusImportError
BioptimusError that is also an ImportError.
Raised when a feature needs an optional dependency shipped as a bioptimus-sdk extra (for example bioptimus-sdk[torch]) that is not installed. Inheriting from both keeps existing except ImportError handlers working while exposing the typed code, context, and remediation that name the missing extra and the exact install command.
wrap_as
BioptimusError propagates unchanged, while any other exception is re-raised as error_cls with code, message, and context augmented with the original exception’s type and detail. This mirrors bioptimus.observability.fsboundary.fs_read, but for arbitrary operations rather than filesystem reads.
The human-readable message for the wrapped error.
The typed error class to raise. Defaults to
BioptimusRuntimeError; pass BioptimusValueError for input-validation failures.Structured context fields recorded on the wrapped error, in addition to the automatically added
error_type and detail.error_cls.
