Skip to content

Commit

Permalink
Merge pull request #273 from BQSKit/change_server_close_error
Browse files Browse the repository at this point in the history
Handle EOFError and ConnectionResetError without chaining exceptions in server connection failure
  • Loading branch information
edyounis authored Sep 8, 2024
2 parents e05f947 + 9fc4126 commit 5176210
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bqskit/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,12 @@ def _send(self, msg: RuntimeMessage, payload: Any) -> None:
except Exception as e:
self.conn = None
self.close()
raise RuntimeError('Server connection unexpectedly closed.') from e
if isinstance(e, (EOFError, ConnectionResetError)):
raise RuntimeError('Server connection unexpectedly closed.')
else:
raise RuntimeError(
'Server connection unexpectedly closed.',
) from e

def _send_recv(
self,
Expand Down

0 comments on commit 5176210

Please sign in to comment.