Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setupXkeysPanel WebHID method emits uncatchable error #112

Closed
loucadufault opened this issue Dec 3, 2024 · 2 comments · Fixed by #113 or #114
Closed

setupXkeysPanel WebHID method emits uncatchable error #112

loucadufault opened this issue Dec 3, 2024 · 2 comments · Fixed by #113 or #114

Comments

@loucadufault
Copy link
Contributor

Because setupXkeysPanel writes data to the device before it returns the Xkeys instance to the caller, it is impossible to attach an error event listener to handle an error thrown from sending the report:

await xkeys.init()

https://github.com/SuperFlyTV/xkeys/blob/master/packages/core/src/xkeys.ts#L341-L350

The fix would be to:

  • handle error events on the xkeys events during the init process
  • return the instance to the caller and let them call init
@loucadufault
Copy link
Contributor Author

Happy to PR. Probably the first approach makes the most sense to avoid a breaking change, and to maintain the all-in-one setup nature of the function.

@loucadufault
Copy link
Contributor Author

loucadufault commented Dec 4, 2024

For reference, the observed symptom in this case is that during setup (after firing the call to setupXkeysPanel), the page crashes with an uncaught (in promise) exception:

NotAllowedError: Failed to write the report

occurring due to an underlying call to this WebHID API which rejects:

https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendReport#notallowederror

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant