Skip to content

Commit

Permalink
Enable error handling for DEV UI JSON RPC req
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvavrik committed May 27, 2023
1 parent 2a867ee commit 117f1d8
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 117f1d8

Please sign in to comment.