Skip to content

Commit 9888edc

Browse files
committed
chore: address review comment
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
1 parent 9cfc080 commit 9888edc

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

tck/errors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ def wrapper(*args, **kwargs):
113113
raise JsonRpcError.hiero_error({"status": ResponseCode(e.status).name}) from e
114114

115115
except MaxAttemptsError as e:
116-
logger.error(f"MaxAttemptsError (method: {func.__name__}, error: {e.message})")
117-
raise JsonRpcError.hiero_error(message=e.message) from e
116+
logger.error(f"MaxAttemptsError (method: {func.__name__}, error: {str(e)})")
117+
raise JsonRpcError.hiero_error() from e
118118

119119
except Exception as e:
120120
logger.error(f"InternalError (method: {func.__name__}) error: {str(e)}")
121-
raise JsonRpcError.internal_error(message="Internal error") from e
121+
raise JsonRpcError.internal_error() from e
122122

123123
return wrapper

tck/handlers/registry.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

8283
def 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

Comments
 (0)