diff --git a/assets/src/server/ballisticacore_server.py b/assets/src/server/ballisticacore_server.py index 6b5a8aae..f0f539d0 100755 --- a/assets/src/server/ballisticacore_server.py +++ b/assets/src/server/ballisticacore_server.py @@ -39,6 +39,7 @@ sys.path += [ ] from efro.terminal import Clr +from efro.error import CleanError from efro.dataclassutils import dataclass_assign, dataclass_validate from bacommon.servermanager import (ServerConfig, StartServerModeCommand) @@ -56,7 +57,10 @@ class ServerManagerApp: """ def __init__(self) -> None: - self._config = self._load_config() + try: + self._config = self._load_config() + except Exception as exc: + raise CleanError(f'Error loading config: {exc}') self._done = False self._process_commands: List[Union[str, ServerCommand]] = [] self._process_commands_lock = Lock() @@ -357,4 +361,9 @@ class ServerManagerApp: if __name__ == '__main__': - ServerManagerApp().run_interactive() + try: + ServerManagerApp().run_interactive() + except CleanError as clean_exc: + # For clean errors, do a simple print and fail; no tracebacks/etc. + clean_exc.print() + sys.exit(1) diff --git a/tools/bacommon/servermanager.py b/tools/bacommon/servermanager.py index 05e7f40d..4fff1ee9 100644 --- a/tools/bacommon/servermanager.py +++ b/tools/bacommon/servermanager.py @@ -79,13 +79,6 @@ class ServerConfig: # over a secure ssh connection. enable_telnet: bool = False - # Port used for telnet. - telnet_port: int = 43250 - - # This can be None for no password but PLEASE do not expose that to the - # world or your machine will likely get owned. - telnet_password: Optional[str] = 'changeme' - # Series length in teams mode (7 == 'best-of-7' series; a team must # get 4 wins) teams_series_length: int = 7 diff --git a/tools/efro/dataclassutils.py b/tools/efro/dataclassutils.py index 9d2f0f9d..501de4bf 100644 --- a/tools/efro/dataclassutils.py +++ b/tools/efro/dataclassutils.py @@ -68,8 +68,8 @@ def dataclass_assign(instance: Any, values: Dict[str, Any]) -> None: fieldsdict = {f.name: f for f in fields} for key, value in values.items(): if key not in fieldsdict: - raise AttributeError(f"'{type(instance).__name__}' dataclass has" - f" no '{key}' field.") + raise AttributeError( + f"'{type(instance).__name__}' has no '{key}' field") field = fieldsdict[key] # We expect to be operating under 'from __future__ import annotations'