Closed hklages closed 3 years ago
"no alarms defined"
Do you mean you're expecting a different error? As in, it throws a new error throw new Error('No alarms to patch');
"No alarms to patch" would also be ok.
But it throws (see the first statement)
TypeError: Cannot read property 'ID' of undefined
That code is already there.... https://github.com/svrooij/node-sonos-ts/blob/08198914ab7b09eec2350c59a3bf08cd8e207c03/src/services/alarm-clock.service.extension.ts#L70-L72
But because to the way I was forcing it to be an array, it made an array with 1 undefined in it.... This is an easy fix
:tada: This issue has been resolved in version 2.4.1-beta.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 2.4.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
What happened
library throws and exception when patching an alarm and there are no alarms.
What did you expect to happen
"no alarms defined"
Alternative: I check in my library the existence of any alarm.
How to reproduce it (minimal and precise)
Just delete all alarms and try to patch one.
Debug logging
{household.disable.alarm:Cannot read property 'ID' of undefined :: Details: {"stack":"TypeError: Cannot read property 'ID' of undefined\n at C:\\Users\\hekla\\Development\\node-red-contrib-sonos-plus\\node_modules\\@svrooij\\sonos\\lib\\services\\alarm-clock.service.extension.js:34:23\n at Array.forEach (<anonymous>)\n at AlarmClockService.ListAndParseAlarms (C:\\Users\\hekla\\Development\\node-red-contrib-sonos-plus\\node_modules\\@svrooij\\sonos\\lib\\services\\alarm-clock.service.extension.js:33:16)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)\n at async AlarmClockService.PatchAlarm (C:\\Users\\hekla\\Development\\node-red-contrib-sonos-plus\\node_modules\\@svrooij\\sonos\\lib\\services\\alarm-clock.service.extension.js:68:24)\n at async Object.householdDisableAlarm [as household.disable.alarm] (C:\\Users\\hekla\\Development\\node-red-contrib-sonos-plus\\src\\sonos-universal.js:1832:5)","message":"Cannot read property 'ID' of undefined"}
Environment
Checklist
Please confirm the following before creating the issue.