use error handling (#7045)

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/7104/head
Sally MacFarlane 7 months ago committed by GitHub
parent 27e5a649d7
commit 73ab9c1a6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/handlers/JsonRpcExecutorHandler.java

@ -58,11 +58,13 @@ public class JsonRpcExecutorHandler {
} catch (IOException e) { } catch (IOException e) {
final String method = executor.getRpcMethodName(ctx); final String method = executor.getRpcMethodName(ctx);
LOG.error("{} - Error streaming JSON-RPC response", method, e); 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)); () -> handleJsonRpcError(ctx, null, RpcErrorType.PARSE_ERROR));
} catch (final RuntimeException e) { } 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); handleJsonRpcError(ctx, null, RpcErrorType.INTERNAL_ERROR);
} }
}; };

Loading…
Cancel
Save