Server isolation and detailed errors

Isolated the JsonServer to server.py inside protocols/json

Added specific errors for server startup timeout and server startup
failed

Refactored errors for Core to CoreError generic and refactored
StateError to CoreStateMismatchError derived from CoreError
This commit is contained in:
2026-08-03 17:17:33 +01:00
parent 321ccb178e
commit 482c093f38
11 changed files with 418 additions and 65 deletions
+22 -1
View File
@@ -2,6 +2,27 @@
# Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
# Core error declarations
class CoreError(Exception):
"""DynaLab Core error."""
class StateError(Exception):
class CoreStateMismatchError(CoreError):
"""DynaLab Core state error."""
# JsonServer error declarations
class JsonServerError(Exception):
"""Generic JsonServer Error"""
class JsonServerTimeoutError(JsonServerError):
"""JsonServer timed out"""
class JsonServerStartupError(JsonServerError):
"""JsonServer crashed on startup"""
def __init__(self, error: Exception) -> None:
self.error = error
super().__init__(f"JSON server failed to start: {error}")