homey-api 1.10.8 → 1.10.9

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.
@@ -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.9",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [