Tweak `Context.repr_outcome()` for KBIs

Since apparently `str(KeyboardInterrupt()) == ''`? So instead add little
`<str> or repr(merr)` expressions throughout to avoid blank strings
rendering if various `repr()`/`.__str__()` outputs..
modden_spawn_from_client_req
Tyler Goodlet 2024-03-08 15:46:42 -05:00
parent 7458f99733
commit 7cafb59ab7
1 changed files with 20 additions and 4 deletions

View File

@ -1485,7 +1485,11 @@ class Context:
TODO: implement this using `outcome.Outcome` types? TODO: implement this using `outcome.Outcome` types?
''' '''
return self.maybe_error or self._result return (
self.maybe_error
or
self._result
)
# @property # @property
def repr_outcome( def repr_outcome(
@ -1520,16 +1524,28 @@ class Context:
# #
# just the type name for now to avoid long lines # just the type name for now to avoid long lines
# when tons of cancels.. # when tons of cancels..
return type(merr).__name__ return (
str(type(merr).__name__)
or
repr(merr)
)
# just the type name # just the type name
# else: # but wen? # else: # but wen?
# return type(merr).__name__ # return type(merr).__name__
# for all other errors show their regular output # 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( async def started(
self, self,