@@ -47,6 +47,9 @@ def dispatch(method_name: str, params: Any) -> Any:
4747 handler = get_handler (method_name )
4848
4949 if handler is None :
50+ logger .warning (
51+ f"MethodNotFoundError (method: { method_name } ) error: The requested RPC method is not registered."
52+ )
5053 raise JsonRpcError .method_not_found_error (message = f"Method not found: { method_name } " )
5154
5255 try :
@@ -62,6 +65,7 @@ def dispatch(method_name: str, params: Any) -> Any:
6265 param_type = hints .get (param_name , parameters [0 ].annotation )
6366 params = param_type .parse_json_params (params )
6467 except (TypeError , ValueError ) as e :
68+ logger .error (f"InvalidParamsError (method: { method_name } ) error: { str (e )} " )
6569 raise JsonRpcError .invalid_params_error (data = str (e )) from e
6670
6771 result = handler (params )
@@ -71,7 +75,7 @@ def dispatch(method_name: str, params: Any) -> Any:
7175 except JsonRpcError :
7276 raise
7377 except Exception as e :
74- logger .exception (f"Unexpected error executing { method_name } " )
78+ logger .error (f"InternalError (method: { method_name } ) error: { str ( e ) } " )
7579 raise JsonRpcError .internal_error (message = "An unexpected system error occurred." ) from e
7680
7781
@@ -81,8 +85,8 @@ def safe_dispatch(method_name: str, params: Any, request_id: str | int | None) -
8185 return dispatch (method_name , params )
8286 except JsonRpcError as e :
8387 return build_json_rpc_error_response (e , request_id )
84- except Exception :
85- logger .exception ( "Fatal runtime dispatch error" )
88+ except Exception as e :
89+ logger .error ( f"InternalError (method: { method_name } ) error: { str ( e ) } " )
8690 error = JsonRpcError .internal_error (message = "An unexpected system error occurred." )
8791 return build_json_rpc_error_response (error , request_id )
8892
0 commit comments