homey-api 3.4.3 → 3.4.5
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.
- package/lib/AthomCloudAPI.js +28 -4
- package/package.json +1 -1
package/lib/AthomCloudAPI.js
CHANGED
|
@@ -381,7 +381,13 @@ for(const {@link HomeyAPIV2.ManagerDevices.Device device} of Object.values(devic
|
|
|
381
381
|
},
|
|
382
382
|
});
|
|
383
383
|
|
|
384
|
-
|
|
384
|
+
let responseBody;
|
|
385
|
+
try {
|
|
386
|
+
responseBody = await response.json();
|
|
387
|
+
} catch (err) {
|
|
388
|
+
this.__debug(`Invalid response from server (${response.status}): ${response.text()}`);
|
|
389
|
+
throw new APIError(`Invalid response from server: ${response.text()}`, response.status);
|
|
390
|
+
}
|
|
385
391
|
|
|
386
392
|
if (!response.ok) {
|
|
387
393
|
throw new APIError(responseBody.error_description || responseBody.error, response.status);
|
|
@@ -444,7 +450,13 @@ for(const {@link HomeyAPIV2.ManagerDevices.Device device} of Object.values(devic
|
|
|
444
450
|
},
|
|
445
451
|
});
|
|
446
452
|
|
|
447
|
-
|
|
453
|
+
let responseBody;
|
|
454
|
+
try {
|
|
455
|
+
responseBody = await response.json();
|
|
456
|
+
} catch (err) {
|
|
457
|
+
this.__debug(`Invalid response from server (${response.status}): ${response.text()}`);
|
|
458
|
+
throw new APIError(`Invalid response from server: ${response.text()}`, response.status);
|
|
459
|
+
}
|
|
448
460
|
|
|
449
461
|
if (!response.ok) {
|
|
450
462
|
throw new APIError(responseBody.error_description || responseBody.error, response.status);
|
|
@@ -506,7 +518,13 @@ for(const {@link HomeyAPIV2.ManagerDevices.Device device} of Object.values(devic
|
|
|
506
518
|
},
|
|
507
519
|
});
|
|
508
520
|
|
|
509
|
-
|
|
521
|
+
let responseBody;
|
|
522
|
+
try {
|
|
523
|
+
responseBody = await response.json();
|
|
524
|
+
} catch (err) {
|
|
525
|
+
this.__debug(`Invalid response from server (${response.status}): ${response.text()}`);
|
|
526
|
+
throw new APIError(`Invalid response from server: ${response.text()}`, response.status);
|
|
527
|
+
}
|
|
510
528
|
|
|
511
529
|
if (!response.ok) {
|
|
512
530
|
throw new APIError(responseBody.error_description || responseBody.error, response.status);
|
|
@@ -552,7 +570,13 @@ for(const {@link HomeyAPIV2.ManagerDevices.Device device} of Object.values(devic
|
|
|
552
570
|
},
|
|
553
571
|
});
|
|
554
572
|
|
|
555
|
-
|
|
573
|
+
let responseBody;
|
|
574
|
+
try {
|
|
575
|
+
responseBody = await response.json();
|
|
576
|
+
} catch (err) {
|
|
577
|
+
this.__debug(`Invalid response from server (${response.status}): ${response.text()}`);
|
|
578
|
+
throw new APIError(`Invalid response from server: ${response.text()}`, response.status);
|
|
579
|
+
}
|
|
556
580
|
|
|
557
581
|
if (!response.ok) {
|
|
558
582
|
throw new APIError(responseBody.error_description || responseBody.error, response.status);
|