-
Notifications
You must be signed in to change notification settings - Fork 11
Conversation
e24dd72
to
62eb3f0
Compare
throw
extension functionsacbd52e
to
994fbc9
Compare
0aac67c
to
ccda2db
Compare
994fbc9
to
7be6fe8
Compare
class GattStatusException(message: String?) : IOException(message) { | ||
constructor( | ||
status: GattStatus, | ||
prefix: String | ||
) : this("$prefix failed with status ${status.asGattStatusString()}") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these constructors be internal
like the other exceptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but...
This exception is also thrown from throw
module.
I tried utilizing friend-paths
(to give throw
module access to internal
definitions in core
) but could not get it working. 😢
Spent about 3 hours trying to get the friend paths working before giving up and just accepting this little bit of cruft on the public API surface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really wish Kotlin had way more visibility modifiers. Something like Android's @RestrictTo
but at a language level.
ccda2db
to
7d546a7
Compare
7be6fe8
to
421ab8f
Compare
lgtm! |
Small update: This PR was brought into |
IOException
chosen for failures where an I/O operation did not succeed. It is expected that library users will catch these exceptions and decide if operation should be retried or if more extreme measures should be taken (e.g. reconnect prior to retrying).Closes #81.
core
RemoteException
Exception
ConnectionLostException
IOException
GattStatusException
IOException
OutOfOrderGattCallbackException
IllegalStateException
OutOfOrderGattCallbackException
should never occur. This failure is not recoverable and the behavior of future requests is undefined. Library user should allow app to crash or re-establish connect (to reset callback state). If this exception is ever encountered it should be reported so it may be investigated.RemoteException
occurs when the Android system fails to execute a request, it is unlikely that retrying the operation will succeed until the user intervenes (e.g. turns on BLE).keep-alive
NotReadyException
IOException
throw
GattStatusException
(core
)IOException
RemoteException
Exception
ConnectionLostException
IOException
📓 Notes
Since
SharedFlow
is not yet officially released, this branch was developed against internally built Coroutines artifacts; this PR will be merged intointernal
branch (see #86 for details).