Errors
Exception hierarchy for mitk-workbench-remote.
All exceptions inherit from MitkError. REST error codes are mapped to specific exception types by RestTransport.
- exception mitk_workbench_remote.errors.MitkError
Bases:
ExceptionBase class for all mitk-workbench-remote exceptions.
- exception mitk_workbench_remote.errors.MitkConnectionError
Bases:
MitkErrorRaised when the network is unreachable or the connection is refused.
- exception mitk_workbench_remote.errors.AuthenticationError(status_code, message)
Bases:
MitkErrorRaised on HTTP 401 (unauthenticated) or 403 (unauthorized) responses.
Callers can inspect
status_codeto distinguish between a missing or invalid token (401) and a valid token with insufficient permissions (403).
- exception mitk_workbench_remote.errors.NodeNotFoundError(uid)
Bases:
MitkErrorRaised when the server returns NODE_NOT_FOUND (HTTP 404).
- Parameters:
uid (
str) – The REST API UID of the node that was not found. May be an empty string at the transport layer when no UID context is available.
- exception mitk_workbench_remote.errors.StaleNodeError
Bases:
MitkErrorRaised when a DataNode reference is used after the node was deleted.
- exception mitk_workbench_remote.errors.DataStorageNotAvailableError
Bases:
MitkErrorRaised when the server returns DATASTORAGE_NOT_AVAILABLE (HTTP 503).
- exception mitk_workbench_remote.errors.UnsupportedDataTypeError(data_type)
Bases:
MitkErrorRaised when a node’s data type cannot be represented in Python.
The MITK Workbench may hold data types (e.g. Surface, PointSet) for which this library has no in-memory representation yet. Use
save_data()to download the raw bytes to a file instead.- Parameters:
data_type (
str) – The MITK data type string that is not supported.
- exception mitk_workbench_remote.errors.TransferError
Bases:
MitkErrorRaised on UNSUPPORTED_FORMAT (HTTP 415) or I/O failure during transfer.
- exception mitk_workbench_remote.errors.RenderingError
Bases:
MitkErrorRaised when the server returns RENDERING_ERROR (HTTP 422).
- exception mitk_workbench_remote.errors.EditorNotActiveError(alias, message=None)
Bases:
MitkErrorRaised when the addressed editor is not currently open in the workbench.
Surfaces server code
EDITOR_NOT_ACTIVE(HTTP 503).
- exception mitk_workbench_remote.errors.RenderWindowNotFoundError(editor_alias, window_id, message=None)
Bases:
MitkErrorRaised when an editor does not know the addressed render window id.
Surfaces server code
RENDER_WINDOW_NOT_FOUND(HTTP 404).
- exception mitk_workbench_remote.errors.UnsupportedOperationError(editor_alias, window_id, operation, message=None)
Bases:
MitkErrorRaised when a sub-resource does not apply to the addressed window.
Surfaces server code
UNSUPPORTED_OPERATION(HTTP 404). The canonical example isselected-sliceon the StdMulti 3D window.- Parameters:
- exception mitk_workbench_remote.errors.ApiError(status_code, code, message)
Bases:
MitkErrorCatch-all for 4xx/5xx responses not covered by a more specific type.
- Parameters:
status_code (
int) – The HTTP status code.code (
str) – The error code string from the RFC 7807 body (e.g."UNKNOWN").message (
str) – The human-readable error message from the response body. Stored on.messagefor structured access;str(err)returns the full"HTTP <status> [<code>]: <message>"form.