Woops, only pack `Error(cid=cid)` if input is not `None`

runtime_to_msgspec
Tyler Goodlet 2024-04-02 14:32:16 -04:00
parent e153cc0187
commit 40cba51909
1 changed files with 4 additions and 13 deletions

View File

@ -498,7 +498,7 @@ def pack_error(
tb: str|None = None, tb: str|None = None,
cid: str|None = None, cid: str|None = None,
) -> Error|dict[str, dict]: ) -> Error:
''' '''
Create an "error message" which boxes a locally caught Create an "error message" which boxes a locally caught
exception's meta-data and encodes it for wire transport via an exception's meta-data and encodes it for wire transport via an
@ -561,19 +561,10 @@ def pack_error(
# content's `.msgdata`). # content's `.msgdata`).
error_msg['tb_str'] = tb_str error_msg['tb_str'] = tb_str
# Error() if cid is not None:
# pkt: dict = { error_msg['cid'] = cid
# 'error': error_msg,
# }
pkt: Error = Error(
cid=cid,
**error_msg,
# TODO: just get rid of `.pld` on this msg?
)
# if cid:
# pkt['cid'] = cid
return pkt return Error(**error_msg)
def unpack_error( def unpack_error(