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

GattStatusException should include the GATT status #161

Open
joharei opened this issue Sep 21, 2021 · 2 comments
Open

GattStatusException should include the GATT status #161

joharei opened this issue Sep 21, 2021 · 2 comments

Comments

@joharei
Copy link
Contributor

joharei commented Sep 21, 2021

I would like to handle errors based on the GATT status, but the GattStatusException doesn't expose that. Currently, I can work around this by checking the exception message, but a nicer solution would be great!

@twyatt
Copy link
Member

twyatt commented Sep 22, 2021

Totally agree, checking GATT status via the message is quite fragile.

Need to determine if there is an elegant way to expose the status in a platform agnostic way.
In other words, need to determine if the GATT statuses (which represent non-success) have enough overlap between the platforms to try and translate the platform specific statuses to a common structure (e.g. enum or similar).

Currently, the exceptions are propagated as:

  • Android: GattStatusException
  • Apple: IOException (with NSError description as message)
  • JavaScript: native failure type (from Promise)

...so this is already exposing inconsistency between the supported platforms. When I have some time I'll see if we can come up with a better API.

@twyatt
Copy link
Member

twyatt commented Aug 16, 2024

Related to #724.

@twyatt twyatt added this to the 0.35.0 milestone Sep 11, 2024
@twyatt twyatt modified the milestones: 0.35.0, 0.36.0 Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants