django-modern-rpc
django-modern-rpc copied to clipboard
Nice would be logging RPCInternalError as error (with traceback) but it is currently logged as warning
trafficstars
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