Skip to content
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

Nice would be logging RPCInternalError as error (with traceback) but it is currently logged as warning #71

Open
tgz-cz opened this issue Sep 10, 2024 · 1 comment

Comments

@tgz-cz
Copy link

tgz-cz commented Sep 10, 2024

I prefer to log unexpected exception (that is converted to RPCInternalError) as error with traceback.
(Or add some settings value so that it can be configured to be logged as error)

Otherwise I must wrap all my RPC-functions by my own wrapper to be error logged:

 @rpc_method
 def divide(a, b):
     try:
         return a / b
     except RPCException:
        raise
     except Exception as exc:
         logging.exception(f"RPCInternalError: {exc}")
         raise RPCInternalError(str(exc)) from exc

Because "default exception handler" does not log errors, but warnings in this case
https://github.com/alorence/django-modern-rpc/blob/main/modernrpc/core.py#L149C9-L151C54

@tgz-cz
Copy link
Author

tgz-cz commented Sep 10, 2024

Or configuration parameter for custom error handler can be added.
Developer can report unexpected exceptions also to other system like Sentry-SDK etc... in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant