Cherry-picked: Reject only with Error instead of Object or String Fixes #132

This commit is contained in:
mmorrison 2019-10-15 14:47:22 -05:00
parent 6d30457722
commit 62723d85f0
2 changed files with 2 additions and 2 deletions

View file

@ -39,7 +39,7 @@ class Core extends EventEmitter {
let abortCall = null; let abortCall = null;
this.abortedPromise = new Promise((resolve,reject) => { 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 // Make sure that if this promise isn't attached to, it doesn't throw a unhandled promise rejection

View file

@ -80,7 +80,7 @@ class Nadeo extends Core {
const sentPromise = new Promise(async (resolve,reject) => { const sentPromise = new Promise(async (resolve,reject) => {
client.methodCall(cmd, params, (err, value) => { 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); resolve(value);
}); });
}); });