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: Exception

Base class for all mitk-workbench-remote exceptions.

exception mitk_workbench_remote.errors.MitkConnectionError

Bases: MitkError

Raised when the network is unreachable or the connection is refused.

exception mitk_workbench_remote.errors.AuthenticationError(status_code, message)

Bases: MitkError

Raised on HTTP 401 (unauthenticated) or 403 (unauthorized) responses.

Callers can inspect status_code to distinguish between a missing or invalid token (401) and a valid token with insufficient permissions (403).

Parameters:
  • status_code (int) – The HTTP status code (401 or 403).

  • message (str) – The human-readable error message from the response body.

exception mitk_workbench_remote.errors.NodeNotFoundError(uid)

Bases: MitkError

Raised 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: MitkError

Raised when a DataNode reference is used after the node was deleted.

exception mitk_workbench_remote.errors.DataStorageNotAvailableError

Bases: MitkError

Raised when the server returns DATASTORAGE_NOT_AVAILABLE (HTTP 503).

exception mitk_workbench_remote.errors.UnsupportedDataTypeError(data_type)

Bases: MitkError

Raised 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: MitkError

Raised on UNSUPPORTED_FORMAT (HTTP 415) or I/O failure during transfer.

exception mitk_workbench_remote.errors.RenderingError

Bases: MitkError

Raised when the server returns RENDERING_ERROR (HTTP 422).

exception mitk_workbench_remote.errors.EditorNotActiveError(alias, message=None)

Bases: MitkError

Raised when the addressed editor is not currently open in the workbench.

Surfaces server code EDITOR_NOT_ACTIVE (HTTP 503).

Parameters:
  • alias (str) – Editor alias addressed by the call (e.g. "stdmulti", "mxn").

  • message (str | None (default: None)) – Human-readable error message from the response body.

exception mitk_workbench_remote.errors.RenderWindowNotFoundError(editor_alias, window_id, message=None)

Bases: MitkError

Raised when an editor does not know the addressed render window id.

Surfaces server code RENDER_WINDOW_NOT_FOUND (HTTP 404).

Parameters:
  • editor_alias (str) – Editor alias addressed by the call. May be an empty string when the URL did not carry editor context.

  • window_id (str) – Render window id (URL segment) that was not found.

  • message (str | None (default: None)) – Human-readable error message from the response body.

exception mitk_workbench_remote.errors.UnsupportedOperationError(editor_alias, window_id, operation, message=None)

Bases: MitkError

Raised when a sub-resource does not apply to the addressed window.

Surfaces server code UNSUPPORTED_OPERATION (HTTP 404). The canonical example is selected-slice on the StdMulti 3D window.

Parameters:
  • editor_alias (str) – Editor alias addressed by the call.

  • window_id (str) – Render window id addressed by the call.

  • operation (str) – Short label for the rejected sub-resource (e.g. "selected-slice").

  • message (str | None (default: None)) – Human-readable error message from the response body.

exception mitk_workbench_remote.errors.ApiError(status_code, code, message)

Bases: MitkError

Catch-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 .message for structured access; str(err) returns the full "HTTP <status> [<code>]: <message>" form.