homey-api 3.0.8 → 3.0.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.
@@ -234,7 +234,7 @@ class Manager extends EventEmitter {
234
234
  stack: err.stack,
235
235
  error: err.error,
236
236
  error_description: err.error_description,
237
- }, err.statusCode || 500);
237
+ }, err.statusCode || err.code || 500);
238
238
  return reject(err);
239
239
  }
240
240
 
@@ -703,8 +703,8 @@ class HomeyAPIV3 extends HomeyAPI {
703
703
  });
704
704
  })
705
705
  .catch(async err => {
706
- // If token is expired, try to refresh
707
- if (err.statusCode === 401) {
706
+ // If token is expired, try to refresh, statusCode is for apiVersion 3 and code for apiVersion 2.
707
+ if (err.statusCode === 401 || err.code === 401) {
708
708
  this.__debug('Token expired, refreshing...');
709
709
  await this.logout();
710
710
  await this.login();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -66,7 +66,7 @@
66
66
  "eslint": "^7.32.0",
67
67
  "eslint-config-athom": "^2.1.1",
68
68
  "fs-extra": "^10.0.0",
69
- "homey-api": "^3.0.6",
69
+ "homey-api": "^3.0.8",
70
70
  "http-server": "^0.12.3",
71
71
  "jsdoc": "^4.0.2",
72
72
  "jsdoc-to-markdown": "^8.0.0",