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