2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-04 09:27:11 +08:00

protocols/pc_rpc: short_exc_info

This commit is contained in:
Sebastien Bourdeauducq 2016-03-25 20:04:53 +08:00
parent 7bdec1b93b
commit 74b3c47614

View File

@ -518,9 +518,13 @@ class Server(_AsyncioServer):
else: else:
raise ValueError("Unknown action: {}" raise ValueError("Unknown action: {}"
.format(obj["action"])) .format(obj["action"]))
except Exception: except Exception as exc:
short_exc_info = type(exc).__name__
exc_str = str(exc)
if exc_str:
short_exc_info += ": " + exc_str.splitlines()[0]
obj = {"status": "failed", obj = {"status": "failed",
"message": traceback.format_exc()} "message": short_exc_info + "\n" + traceback.format_exc()}
line = pyon.encode(obj) + "\n" line = pyon.encode(obj) + "\n"
writer.write(line.encode()) writer.write(line.encode())
except (ConnectionResetError, ConnectionAbortedError, BrokenPipeError): except (ConnectionResetError, ConnectionAbortedError, BrokenPipeError):