JuulLabs / kable

Kotlin Asynchronous Bluetooth Low-Energy
https://juullabs.github.io/kable
Apache License 2.0
812 stars 80 forks source link

Improve documentation for `Peripheral.connect` #614

Open twyatt opened 9 months ago

twyatt commented 9 months ago

Would it make sense to document BluetoothDisabledException as another possible exception on Peripheral.connect? Currently only ConnectionRejectedException and CancellationException are documented.

To make my intrusion worse: I went through the code and got the following questions, which I can turn into their own issues if thats a better place for them. They both are about documentation.

  1. It looks liks Scanner.advertisements can throw BluetoothDisabledException and ScanFailedException, which I believe would crash my app if the CoroutineContext with which I collect advertisements does not use a SupervisorJob and if I don't use Flow.catch. Would it make sense to document these exceptions on that property?
  2. (Nearly same as my initial question) If I am not mistaken then Peripheral.connect can throw ConnectionRejectedException, BluetoothDisabledException and ConnectionLostException. Should these be documented?

I can create a PR with such documentation if desired.

Originally posted by @degill in https://github.com/JuulLabs/kable/issues/366#issuecomment-1845255539

twyatt commented 2 months ago

Related to #724.