summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/lib/ipc-facade.js4
-rw-r--r--app/lib/jsonrpc-ws-ipc.js15
2 files changed, 15 insertions, 4 deletions
diff --git a/app/lib/ipc-facade.js b/app/lib/ipc-facade.js
index f82c0a326a..89c29ce795 100644
--- a/app/lib/ipc-facade.js
+++ b/app/lib/ipc-facade.js
@@ -43,7 +43,7 @@ export class RealIpc implements IpcFacade {
if (typeof raw === 'object' && raw && raw.paid_until) {
return raw;
} else {
- throw new InvalidReply(raw);
+ throw new InvalidReply(raw, 'Expected an object with paid_until');
}
});
}
@@ -78,7 +78,7 @@ export class RealIpc implements IpcFacade {
if (typeof raw === 'string' && raw) {
return raw;
} else {
- throw new InvalidReply(raw);
+ throw new InvalidReply(raw, 'Expected a string');
}
});
}
diff --git a/app/lib/jsonrpc-ws-ipc.js b/app/lib/jsonrpc-ws-ipc.js
index 7c8cf55302..44caf12d5c 100644
--- a/app/lib/jsonrpc-ws-ipc.js
+++ b/app/lib/jsonrpc-ws-ipc.js
@@ -40,9 +40,12 @@ export type JsonRpcSuccess = {
export type JsonRpcMessage = JsonRpcError | JsonRpcNotification | JsonRpcSuccess;
export class TimeOutError extends Error {
- constructor() {
+ jsonRpcMessage: Object;
+
+ constructor(jsonRpcMessage: Object) {
super('Request timed out');
this.name = 'TimeOutError';
+ this.jsonRpcMessage = jsonRpcMessage;
}
}
@@ -53,6 +56,11 @@ export class InvalidReply extends Error {
super(msg);
this.name = 'InvalidReply';
this.reply = reply;
+
+ if(msg) {
+ this.message = msg + ' - ';
+ }
+ this.message += JSON.stringify(reply);
}
}
@@ -93,8 +101,11 @@ export default class Ipc {
if (typeof subscriptionId === 'string' || typeof subscriptionId === 'number') {
this._subscriptions[subscriptionId] = listener;
} else {
- throw new InvalidReply(subscriptionId);
+ throw new InvalidReply(subscriptionId, 'The subscription id was not a string or a number');
}
+ })
+ .catch(e => {
+ log.error('Failed adding listener to', event, ':', e);
});
}