Skip to content

Document ApiException throw behavior for AppHelper node queries - #2804

Draft
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:docs-apphelper-node-availability
Draft

Document ApiException throw behavior for AppHelper node queries#2804
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:docs-apphelper-node-availability

Conversation

@rootkiller6788

Copy link
Copy Markdown

Problem

connectedAndInstalledNodes and connectedNodes() both hit the Wearable API (CapabilityClient / NodeClient) via .await(). When the Wearable API is not available on a device, these calls throw ApiException: 17: API: Wearable.API is not available on this device, but this throw behavior was completely undocumented. Library users discovered this the hard way (see #2596) because the failure surfaces as an opaque GMS stack trace with no Horologist frame in sight.

isAvailable() exists precisely to guard against this, but nothing in the doc pointed users to it.

Change

Add @throws ApiException KDoc to the two public entry points (connectedNodes() and the abstract connectedAndInstalledNodes property), both referencing isAvailable() as the way to check before use. No behavioral change — documentation only.

Verification

Fixes #2596

connectedNodes() and connectedAndInstalledNodes throw ApiException when
the Wearable API is not available on the device, but this was not
documented, surprising library users (see issue google#2596). Point callers
to isAvailable() so they can guard against the crash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

connectedAndInstalledNodes throws into the outer scope when API is not available

1 participant