From 117f1d888b17c75a4f3991e92942784de7c2fb09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Sat, 27 May 2023 17:06:27 +0200 Subject: [PATCH] Enable error handling for DEV UI JSON RPC req --- .../resources/dev-ui/controller/jsonrpc.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js index 0a097a92baa9f..f141734fb9de2 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js @@ -245,6 +245,24 @@ export class JsonRpc { JsonRpc.webSocket.onmessage = function (event) { var response = JSON.parse(event.data); var devUiResponse = response.result; + + if (!devUiResponse && response.error) { + if (JsonRpc.promiseQueue.has(response.id)) { + var saved = JsonRpc.promiseQueue.get(response.id); + var promise = saved.promise; + var log = saved.log; + + promise.reject_ex(response); + JsonRpc.promiseQueue.delete(response.id); + if (log) { + var jsonrpcpayload = JSON.stringify(response); + JsonRpc.dispatchMessageLogEntry(Level.Error, MessageDirection.Down, jsonrpcpayload); + } + } + + return; + } + var messageType = devUiResponse.messageType; if (messageType === MessageType.Void.toString()) { // Void response, typically used on initial subscription