Ignoring expected errors
This commit is contained in:
parent
34bca9c705
commit
e4cc9da122
@ -153,13 +153,21 @@ export class FluxAccessory implements IAccessory {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isHueError = (object: any): object is HueError => {
|
||||||
|
return '_hueError' in object;
|
||||||
|
}
|
||||||
|
|
||||||
private setLights = async (state: LightState) => {
|
private setLights = async (state: LightState) => {
|
||||||
const promises: Array<Promise<unknown> | PromiseLike<unknown>> = [];
|
const promises: Array<Promise<unknown> | PromiseLike<unknown>> = [];
|
||||||
this._lights.map(async (light: Light) => {
|
this._lights.map(async (light: Light) => {
|
||||||
try {
|
try {
|
||||||
await this._hue.lights.setLightState(light.id, state);
|
await this._hue.lights.setLightState(light.id, state);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._log(`Error while setting lights: ${err}`);
|
if (this.isHueError(err) && err.message === "Error: parameter, xy, is not modifiable. Device is set to off.") {
|
||||||
|
//Eat this
|
||||||
|
} else {
|
||||||
|
this._log(`Error while setting lights: ${err}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user