From 73ab9c1a6bb06cb6ce106b4cbb1cd239c1264340 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Wed, 15 May 2024 09:18:27 +1000 Subject: [PATCH] use error handling (#7045) Signed-off-by: Sally MacFarlane --- .../besu/ethereum/api/handlers/JsonRpcExecutorHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/handlers/JsonRpcExecutorHandler.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/handlers/JsonRpcExecutorHandler.java index 5e4c4af9c4..278a38c557 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/handlers/JsonRpcExecutorHandler.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/handlers/JsonRpcExecutorHandler.java @@ -58,11 +58,13 @@ public class JsonRpcExecutorHandler { } catch (IOException e) { final String method = executor.getRpcMethodName(ctx); LOG.error("{} - Error streaming JSON-RPC response", method, e); - throw new RuntimeException(e); + handleJsonRpcError(ctx, null, RpcErrorType.INTERNAL_ERROR); } }, () -> handleJsonRpcError(ctx, null, RpcErrorType.PARSE_ERROR)); } catch (final RuntimeException e) { + final String method = ctx.get(ContextKey.REQUEST_BODY_AS_JSON_OBJECT.name()); + LOG.error("Unhandled exception in JSON-RPC executor for method {}", method, e); handleJsonRpcError(ctx, null, RpcErrorType.INTERNAL_ERROR); } };