homey-api 1.10.8 → 1.10.10

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.
@@ -264,6 +264,9 @@
264
264
 
265
265
 
266
266
 
267
+ args: {
268
+
269
+
267
270
  homey: Homey,
268
271
 
269
272
 
@@ -271,6 +274,9 @@
271
274
  debug: boolean,
272
275
 
273
276
 
277
+ },
278
+
279
+
274
280
 
275
281
 
276
282
  )
@@ -48,8 +48,9 @@ class HomeyAPIApp extends HomeyAPIV2 {
48
48
  static DISCOVERY_STRATEGIES = {};
49
49
 
50
50
  /**
51
- * @param {Homey} homey - The Homey instance of your app, usually `this.homey`.
52
- * @param {boolean} [debug=false] - Enable debug logs.
51
+ * @param {Object} args
52
+ * @param {Homey} args.homey - The Homey instance of your app, usually `this.homey`.
53
+ * @param {boolean} [args.debug=false] - Enable debug logs.
53
54
  */
54
55
  constructor({
55
56
  homey,
@@ -255,8 +255,25 @@ class Manager extends EventEmitter {
255
255
  args,
256
256
  operation: operationId,
257
257
  uri: this.uri,
258
- }, (error, result) => {
259
- if (error) return reject(new HomeyAPIError({ error }));
258
+ }, (err, result) => {
259
+ // String Error
260
+ if (typeof err === 'string') {
261
+ err = new HomeyAPIError({
262
+ error: err,
263
+ }, 500);
264
+ return reject(err);
265
+ }
266
+
267
+ // Object Error
268
+ if (typeof err === 'object' && err !== null) {
269
+ err = new HomeyAPIError({
270
+ stack: err.stack,
271
+ error: err.error,
272
+ error_description: err.error_description,
273
+ }, err.statusCode || 500);
274
+ return reject(err);
275
+ }
276
+
260
277
  return resolve(result);
261
278
  });
262
279
  }), $timeout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "1.10.8",
3
+ "version": "1.10.10",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [