Skip to content

Commit dbd5c76

Browse files
committed
fix: unexpected line now creates a warning instead of an assertion
1 parent 2b2f149 commit dbd5c76

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

chess/engine.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,10 @@ def _start(self) -> None:
12451245
self._handle_exception(err)
12461246

12471247
def _line_received(self, line: str) -> None:
1248-
assert self.state in [CommandState.ACTIVE, CommandState.CANCELLING], self.state
1248+
if self.state not in [CommandState.ACTIVE, CommandState.CANCELLING]:
1249+
LOGGER.warning(f"engine sent unexpected line \"{line}\" in state {self.state}, ignoring")
1250+
return
1251+
12491252
try:
12501253
self.line_received(line)
12511254
except EngineError as err:

0 commit comments

Comments
 (0)