diff --git a/protocols/core.js b/protocols/core.js index a21a331..9791970 100644 --- a/protocols/core.js +++ b/protocols/core.js @@ -39,7 +39,7 @@ class Core extends EventEmitter { let abortCall = null; this.abortedPromise = new Promise((resolve,reject) => { - abortCall = () => reject("Query is finished -- cancelling outstanding promises"); + abortCall = () => reject(new Error("Query is finished -- cancelling outstanding promises")); }); // Make sure that if this promise isn't attached to, it doesn't throw a unhandled promise rejection diff --git a/protocols/nadeo.js b/protocols/nadeo.js index 7b46788..55041b2 100644 --- a/protocols/nadeo.js +++ b/protocols/nadeo.js @@ -80,7 +80,7 @@ class Nadeo extends Core { const sentPromise = new Promise(async (resolve,reject) => { client.methodCall(cmd, params, (err, value) => { - if (err) reject('XMLRPC error ' + JSON.stringify(err)); + if (err) reject(new Error('XMLRPC error ' + JSON.stringify(err))); resolve(value); }); });