@@ -50,7 +50,7 @@ def dispatch(method_name: str, params: Any) -> Any:
5050 logger .warning (
5151 f"MethodNotFoundError (method: { repr (method_name )} ) error: The requested RPC method is not registered."
5252 )
53- raise JsonRpcError .method_not_found_error (message = f"Method not found: { method_name } " )
53+ raise JsonRpcError .method_not_found_error ()
5454
5555 try :
5656 target_func = getattr (handler , "__wrapped__" , handler )
@@ -72,22 +72,24 @@ def dispatch(method_name: str, params: Any) -> Any:
7272
7373 return parse_result (result )
7474
75- except JsonRpcError :
75+ except JsonRpcError as e :
76+ logger .error (f"JsonRpcError (method: { repr (method_name )} ) error: { str (e )} " )
7677 raise
7778 except Exception as e :
7879 logger .error (f"InternalError (method: { repr (method_name )} ) error: { str (e )} " )
79- raise JsonRpcError .internal_error (message = "An unexpected system error occurred." ) from e
80+ raise JsonRpcError .internal_error () from e
8081
8182
8283def safe_dispatch (method_name : str , params : Any , request_id : str | int | None ) -> Any | dict [str , Any ]:
8384 """Safely dispatch the request and handle exceptions."""
8485 try :
8586 return dispatch (method_name , params )
8687 except JsonRpcError as e :
88+ logger .error (f"JsonRpcError (method: { repr (method_name )} ) error: { str (e )} " )
8789 return build_json_rpc_error_response (e , request_id )
8890 except Exception as e :
8991 logger .error (f"InternalError (method: { repr (method_name )} ) error: { str (e )} " )
90- error = JsonRpcError .internal_error (message = "An unexpected system error occurred." )
92+ error = JsonRpcError .internal_error ()
9193 return build_json_rpc_error_response (error , request_id )
9294
9395
0 commit comments