forked from goodboy/tractor
1
0
Fork 0

Hide `_invoke()` tb, move actor error to exceptions mod

ctx_debugger
Tyler Goodlet 2021-07-31 13:56:26 -04:00
parent 0afa7f0f8e
commit 6006adc0de
3 changed files with 12 additions and 8 deletions

View File

@ -41,10 +41,6 @@ from . import _mp_fixup_main
log = get_logger('tractor') log = get_logger('tractor')
class ActorFailure(Exception):
"General actor failure"
async def _invoke( async def _invoke(
actor: 'Actor', actor: 'Actor',
@ -56,8 +52,10 @@ async def _invoke(
Union[trio.CancelScope, BaseException] Union[trio.CancelScope, BaseException]
] = trio.TASK_STATUS_IGNORED, ] = trio.TASK_STATUS_IGNORED,
): ):
"""Invoke local func and deliver result(s) over provided channel. '''Invoke local func and deliver result(s) over provided channel.
"""
'''
__tracebackhide__ = True
treat_as_gen = False treat_as_gen = False
# possible a traceback (not sure what typing is for this..) # possible a traceback (not sure what typing is for this..)

View File

@ -12,6 +12,10 @@ import trio
_this_mod = importlib.import_module(__name__) _this_mod = importlib.import_module(__name__)
class ActorFailure(Exception):
"General actor failure"
class RemoteActorError(Exception): class RemoteActorError(Exception):
# TODO: local recontruction of remote exception deats # TODO: local recontruction of remote exception deats
"Remote actor exception bundled locally" "Remote actor exception bundled locally"
@ -40,6 +44,7 @@ class InternalActorError(RemoteActorError):
class TransportClosed(trio.ClosedResourceError): class TransportClosed(trio.ClosedResourceError):
"Underlying channel transport was closed prior to use" "Underlying channel transport was closed prior to use"
class ContextCancelled(RemoteActorError): class ContextCancelled(RemoteActorError):
"Inter-actor task context cancelled itself on the callee side." "Inter-actor task context cancelled itself on the callee side."
@ -58,7 +63,7 @@ class NoRuntime(RuntimeError):
def pack_error( def pack_error(
exc: BaseException, exc: BaseException,
tb = None, tb=None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
"""Create an "error message" for tranmission over """Create an "error message" for tranmission over

View File

@ -29,8 +29,9 @@ from ._state import (
from .log import get_logger from .log import get_logger
from ._portal import Portal from ._portal import Portal
from ._actor import Actor, ActorFailure from ._actor import Actor
from ._entry import _mp_main from ._entry import _mp_main
from ._exceptions import ActorFailure
log = get_logger('tractor') log = get_logger('tractor')