# Copyright (C) 2026 Hector van der Aa # Copyright (C) 2026 Association Exergie # SPDX-License-Identifier: GPL-3.0-or-later """Public exceptions raised by DynaLab Core. Catch a subsystem exception when recovery depends on where an operation failed, or catch :class:`DynaLabError` to handle every expected library error. The ``code`` attribute is stable and intended for programmatic decisions; the exception message is written for people. """ class DynaLabError(Exception): """Base class for expected errors raised by DynaLab Core.""" def __init__(self, message: str, *, code: str) -> None: self.code = code super().__init__(message) class CoreError(DynaLabError): """The core cannot perform the requested lifecycle or mode operation.""" class DLPakError(DynaLabError): """A DLPak archive cannot be prepared, read, or written.""" class DLUnitError(DynaLabError): """A DLPak archive cannot be prepared, read, or written.""" class DeriveError(DynaLabError): """A derive unit cannot be created or used as requested.""" class PlaybackError(DynaLabError): """The playback engine cannot perform the requested operation.""" class ConnectorError(DynaLabError): """A connector endpoint or registry operation failed.""" class JsonServerError(DynaLabError): """The JSON protocol server cannot perform the requested operation.""" __all__ = [ "ConnectorError", "CoreError", "DLPakError", "DeriveError", "DynaLabError", "JsonServerError", "PlaybackError", ]