forked from goodboy/tractor
1
0
Fork 0

Allow passing error type to `unpack_error()`

contexts
Tyler Goodlet 2019-01-12 13:26:02 -05:00
parent 3092dc6df6
commit a9932e6c01
1 changed files with 2 additions and 2 deletions

View File

@ -55,12 +55,12 @@ def pack_error(exc):
}
def unpack_error(msg, chan=None):
def unpack_error(msg, chan=None, err_type=RemoteActorError):
"""Unpack an 'error' message from the wire
into a local ``RemoteActorError``.
"""
tb_str = msg['error'].get('tb_str', '')
return RemoteActorError(
return err_type(
f"{chan.uid}\n" + tb_str,
**msg['error'],
)