-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommend error handling #94
Comments
Think it's a good idea |
what about: Args = TypeVar(name="Args")
Kwargs = TypeVar(name="Kwargs")
@dataclass
class CoroError(PyeeError, Generic[Args, Kwargs]):
exc: Exception
handler: CoroHandler
args: Args
kwargs: Kwargs
def _emit_run(self, f: CoroHandler, args: Iterable[Args], kwargs: Dict[str, Kwargs]):
try:
coro = f(*args, **kwargs)
except Exception as exc:
self.emit("error",CoroError(exc=exc,handler=f,args=args, kwargs=kwargs) |
Looks good, but i dont know why you need to use Protocol, didnt see it in other projects and dont know how it's works, but i will check it |
Protocol might be a red herring, you can probably substitute |
I took these notes and captured a plan for potential feature work in #102. In the meantime, I don't have any great answers aside from capturing Exceptions at the top of your handler "manually". Thanks! |
Current error handling
recommend to include the function name/args/kwargs etc to help with debugging
or some such thing
The text was updated successfully, but these errors were encountered: