Closed Julusian closed 1 year ago
It seems that the errors are already emitted as errors on XKeysWatcher.
In #67c2bfc I added the error listener to the documentation. When testing, the errors are emitted like so:
xkeys\packages\node>node examples\basic-log-all-events.js
Error in XKeysWatcher Error: cannot open device with path xyz
at setupXkeysPanel (xkeys\packages\node\dist\methods.js:49:15)
at XKeysWatcher.handleNewDevice (xkeys\packages\node\dist\watcher.js:196:32)
at XKeysWatcher.updateConnectedDevices (xkeys\packages\node\dist\watcher.js:181:22)
at Timeout._onTimeout (xkeys\packages\node\dist\watcher.js:136:22)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
Running the
basic-log-all-events.js
example, if I plug in an xkeys that node-hid is unable to open for some reason, it results in an UnhandledPromiseRejectionWarning.It would be good to have these emitted as an 'error' event on the watcher, so that is is possible to catch them.
Full stack: