From e62d68e877b72f3c4cf49a515672ee62888bb79d Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Mon, 17 Dec 2018 20:38:21 +1300 Subject: [PATCH] Detailed msg when log filter not found (#428) --- .../ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java | 2 +- .../ethereum/jsonrpc/internal/response/JsonRpcError.java | 1 + .../ethereum/jsonrpc/internal/methods/EthGetFilterLogsTest.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java index 49faf6c66f..557aba5cad 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java @@ -48,6 +48,6 @@ public class EthGetFilterLogs implements JsonRpcMethod { return new JsonRpcSuccessResponse(request.getId(), new LogsResult(logs)); } - return new JsonRpcErrorResponse(request.getId(), JsonRpcError.FILTER_NOT_FOUND); + return new JsonRpcErrorResponse(request.getId(), JsonRpcError.LOGS_FILTER_NOT_FOUND); } } diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/response/JsonRpcError.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/response/JsonRpcError.java index 397c0a058c..c03a35ba78 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/response/JsonRpcError.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/response/JsonRpcError.java @@ -28,6 +28,7 @@ public enum JsonRpcError { // Filter & Subscription Errors FILTER_NOT_FOUND(-32000, "Filter not found"), + LOGS_FILTER_NOT_FOUND(-32000, "Logs filter not found"), SUBSCRIPTION_NOT_FOUND(-32000, "Subscription not found"), NO_MINING_WORK_FOUND(-32000, "No mining work available yet"), diff --git a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogsTest.java b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogsTest.java index 73e0bcaae6..51c9d1c3e5 100644 --- a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogsTest.java +++ b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogsTest.java @@ -88,7 +88,7 @@ public class EthGetFilterLogsTest { public void shouldReturnFilterNotFoundWhenFilterManagerReturnsNull() { final JsonRpcRequest request = requestWithFilterId("NOT FOUND"); final JsonRpcResponse expectedResponse = - new JsonRpcErrorResponse(null, JsonRpcError.FILTER_NOT_FOUND); + new JsonRpcErrorResponse(null, JsonRpcError.LOGS_FILTER_NOT_FOUND); when(filterManager.logs(eq("NOT FOUND"))).thenReturn(null); final JsonRpcResponse response = method.response(request);