From 7cafb59ab7f35b4d5fbdfa43ac65849a2c96ffdd Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 8 Mar 2024 15:46:42 -0500 Subject: [PATCH] Tweak `Context.repr_outcome()` for KBIs Since apparently `str(KeyboardInterrupt()) == ''`? So instead add little ` or repr(merr)` expressions throughout to avoid blank strings rendering if various `repr()`/`.__str__()` outputs.. --- tractor/_context.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tractor/_context.py b/tractor/_context.py index ee05819..a7ce583 100644 --- a/tractor/_context.py +++ b/tractor/_context.py @@ -1485,7 +1485,11 @@ class Context: TODO: implement this using `outcome.Outcome` types? ''' - return self.maybe_error or self._result + return ( + self.maybe_error + or + self._result + ) # @property def repr_outcome( @@ -1520,16 +1524,28 @@ class Context: # # just the type name for now to avoid long lines # when tons of cancels.. - return type(merr).__name__ + return ( + str(type(merr).__name__) + or + repr(merr) + ) # just the type name # else: # but wen? # return type(merr).__name__ # for all other errors show their regular output - return str(merr) + return ( + str(merr) + or + repr(merr) + ) - return str(self._result) + return ( + str(self._result) + or + repr(self._result) + ) async def started( self,