Repository navigation
darwin: return ATT errors as AttributeProtocolError - #499
Merged
Merged
Conversation
Member
|
Thank you. tinygo-org/cbgo#20 is merged and tagged as v0.1.0. Please change go.mod to github.com/tinygo-org/cbgo v0.1.0, run go mod tidy, and mark this PR as ready for review. The current version points at a commit that is only on the nserror-domain branch. |
acouvreur
marked this pull request as ready for review
October 9, 2026 15:53
deadprogram
approved these changes
Oct 9, 2026
deadprogram
left a comment
Member
There was a problem hiding this comment.
Looking good @acouvreur thanks! Now merging.
cbgo v0.1.0 adds NSError.Domain. It also requires golang.org/x/crypto v0.26.0, which raises x/crypto, x/sys and x/term here.
An ATT error from the peripheral reached the caller as a *cbgo.NSError, with a localized message and a code that is ambiguous without its domain. Read, Write and EnableNotifications now return errors in CBATTErrorDomain as AttributeProtocolError. Errors in other domains are returned unchanged.
deadprogram
force-pushed
the
darwin-att-errors
branch
from
October 9, 2026 17:43
fc892bd to
c790ad9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #498
Read, Write and EnableNotifications on macOS now return an ATT error from the peripheral as AttributeProtocolError, using the error domain that tinygo-org/cbgo#20 adds. Errors in other domains, such as CBErrorDomain, are returned unchanged.
Draft until cbgo has a release with tinygo-org/cbgo#20. Until then go.mod points at that PR's commit. Updating cbgo also raises golang.org/x/crypto, x/sys and x/term, which cbgo master already requires.
Tested on macOS 15.7.7 against an ESP32-S3 peripheral. A write the peripheral rejects with Invalid PDU now returns AttributeProtocolError 0x04 instead of a *cbgo.NSError. The smoketest-macos builds pass, and so do the TinyGo builds for pca10040-s132v6, pca10056-s140v7, nano-rp2040 and pico-w.