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:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user