From 40cba519092d5ad28ccec380219d70e92d8452de Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 2 Apr 2024 14:32:16 -0400 Subject: [PATCH] Woops, only pack `Error(cid=cid)` if input is not `None` --- tractor/_exceptions.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/tractor/_exceptions.py b/tractor/_exceptions.py index 7deda9d..9c1dc36 100644 --- a/tractor/_exceptions.py +++ b/tractor/_exceptions.py @@ -498,7 +498,7 @@ def pack_error( tb: str|None = None, cid: str|None = None, -) -> Error|dict[str, dict]: +) -> Error: ''' Create an "error message" which boxes a locally caught exception's meta-data and encodes it for wire transport via an @@ -561,19 +561,10 @@ def pack_error( # content's `.msgdata`). error_msg['tb_str'] = tb_str - # Error() - # pkt: dict = { - # 'error': error_msg, - # } - pkt: Error = Error( - cid=cid, - **error_msg, - # TODO: just get rid of `.pld` on this msg? - ) - # if cid: - # pkt['cid'] = cid + if cid is not None: + error_msg['cid'] = cid - return pkt + return Error(**error_msg) def unpack_error(