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.
|
@@ -48,8 +48,9 @@ class HomeyAPIApp extends HomeyAPIV2 {
|
|
|
48
48
|
static DISCOVERY_STRATEGIES = {};
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* @param {
|
|
52
|
-
* @param {
|
|
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
|
-
}, (
|
|
259
|
-
|
|
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);
|