Skip to content

Commit

Permalink
Merge pull request #33648 from michalvavrik/dev-ui-jsonrpc-error-hand…
Browse files Browse the repository at this point in the history
…ling

DEV UI - Enable error handling for JSON RPC client and normal requests-response cases
  • Loading branch information
phillip-kruger authored May 29, 2023
2 parents 588b612 + 117f1d8 commit 588f287
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 588f287

Please sign in to comment.