You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@thegecko, you're right. 🙂 My use-case for this library at the moment is in Electron, as they don't currently support native WebUSB due to issues with the browser UI needing to ask permission before accessing devices. As such I'd like my code to be as API-compatible as possible so I can (in theory) seamlessly switch between the two.
What about at least an error which emulates the shape of DOMException? Namely that it would have a name property? That seems to be the only real difference between a normal Error, and would allow code which checks the name of the error to work with both this library, and a browser implementation.
For the errors listed in the spec (
InvalidStateError
,NotFoundError
, etc), these should beDOMException
s with the name set accordingly.Example:
To make it cleaner to implement in the code, may consider using a helper class for each error:
The text was updated successfully, but these errors were encountered: