feat: Improve diagnostics in IO exception

This commit is contained in:
Leni Aniva 2024-10-06 23:22:30 -07:00
parent a281557d0a
commit 402df63395
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
1 changed files with 5 additions and 2 deletions

View File

@ -19,7 +19,7 @@ class TacticFailure(Exception):
class ServerError(Exception): class ServerError(Exception):
pass pass
DEFAULT_CORE_OPTIONS=["maxHeartbeats=0", "maxRecDepth=10000"] DEFAULT_CORE_OPTIONS=["maxHeartbeats=0", "maxRecDepth=100000"]
class Server: class Server:
@ -91,7 +91,10 @@ class Server:
try: try:
return json.loads(line) return json.loads(line)
except Exception as e: except Exception as e:
raise ServerError(f"Cannot decode: {line}") from e self.proc.sendeof()
remainder = self.proc.read()
self.proc = None
raise ServerError(f"Cannot decode: {line}\n{remainder}") from e
except pexpect.exceptions.TIMEOUT as exc: except pexpect.exceptions.TIMEOUT as exc:
raise exc raise exc