From 58a818472c1b1a0b1d447c2078794ed7d887e040 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 10 Mar 2025 11:17:46 -0400 Subject: [PATCH] Avoid attr-err when `._ipc_msg==None` Seems this can happen in particular when we raise a `MessageTypeError` on the sender side of a `Context`, since there isn't any msg relayed from the other side (though i'm wondering if MTE should derive from RAE then considering this case?). Means `RemoteActorError.boxed_type = None` in such cases instead of raising an attr-error for the `None.boxed_type_str`. --- tractor/_exceptions.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tractor/_exceptions.py b/tractor/_exceptions.py index 249ea16..f9e18e1 100644 --- a/tractor/_exceptions.py +++ b/tractor/_exceptions.py @@ -432,9 +432,13 @@ class RemoteActorError(Exception): Error type boxed by last actor IPC hop. ''' - if self._boxed_type is None: + if ( + self._boxed_type is None + and + (ipc_msg := self._ipc_msg) + ): self._boxed_type = get_err_type( - self._ipc_msg.boxed_type_str + ipc_msg.boxed_type_str ) return self._boxed_type @@ -1143,6 +1147,8 @@ def unpack_error( which is the responsibilitiy of the caller. ''' + # XXX, apparently we pass all sorts of msgs here? + # kinda odd but seems like maybe they shouldn't be? if not isinstance(msg, Error): return None