homey-api 3.4.0 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ const APIDefinition = require('../APIDefinition');
4
4
 
5
5
  const Homey = require('./Homey');
6
6
  const Device = require('./Device');
7
+ const APIErrorNotFound = require('../APIErrorNotFound');
7
8
 
8
9
  /**
9
10
  * A user on {@link AthomCloudAPI}.
@@ -42,7 +43,7 @@ class User extends APIDefinition {
42
43
  const homey = this.homeys.find(homey => homey.id === id);
43
44
 
44
45
  if (!homey) {
45
- throw new Error(`Homey Not Found: ${id}`);
46
+ throw new APIErrorNotFound(`Homey Not Found: ${id}`);
46
47
  }
47
48
 
48
49
  return homey;
package/lib/Util.js CHANGED
@@ -244,15 +244,16 @@ class Util {
244
244
  .catch(err => {
245
245
  rejections[i] = err;
246
246
 
247
- if (rejections.length === promises.length) {
248
- reject(rejections[i]);
247
+ // Check if all promises have been rejected
248
+ if (rejections.filter(Boolean).length === promises.length) {
249
+ reject(rejections);
249
250
  }
250
251
  });
251
252
  });
252
253
  });
253
254
  }
254
255
 
255
- /**
256
+ /**
256
257
  * Converts an object to a query string
257
258
  * @param {object} queryObject - Query parameter object
258
259
  * @returns {string}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [