diff --git a/CHANGELOG.md b/CHANGELOG.md index 16f9b2547..a15ad6604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * fixed several code issues found by sonar [#2113](https://github.com/hyperledger/web3j/pull/2113) * update GitHub actions versions [#2114](https://github.com/hyperledger/web3j/pull/2114) +* fixed request parsing exception handling [#2120](https://github.com/hyperledger/web3j/pull/2120) * fixed subscription object leaking after disconnect [#2121](https://github.com/hyperledger/web3j/pull/2121) ### Features diff --git a/core/src/main/java/org/web3j/protocol/websocket/WebSocketService.java b/core/src/main/java/org/web3j/protocol/websocket/WebSocketService.java index 107ba4a0d..3df455f31 100644 --- a/core/src/main/java/org/web3j/protocol/websocket/WebSocketService.java +++ b/core/src/main/java/org/web3j/protocol/websocket/WebSocketService.java @@ -299,7 +299,7 @@ private void processRequestReply(String replyStr, JsonNode replyJson) throws IOE } sendReplyToListener(request, reply); - } catch (IllegalArgumentException e) { + } catch (Exception e) { sendExceptionToListener(replyStr, request, e); } } @@ -322,7 +322,7 @@ private void processBatchRequestReply(String replyStr, ArrayNode replyJson) thro } sendReplyToListener(webSocketRequests, new BatchResponse(requests, responses)); - } catch (IllegalArgumentException e) { + } catch (Exception e) { sendExceptionToListener(replyStr, webSocketRequests, e); } } @@ -375,7 +375,7 @@ private void sendReplyToListener(WebSocketRequest request, Object reply) { } private void sendExceptionToListener( - String replyStr, WebSocketRequest request, IllegalArgumentException e) { + String replyStr, WebSocketRequest request, Exception e) { request.getOnReply() .completeExceptionally( new IOException(