react-native-tethering icon indicating copy to clipboard operation
react-native-tethering copied to clipboard

disconnectFromLocalNetwork: reject the promise there is an unhandled exception

Open SamakaCD opened this issue 2 years ago • 3 comments

It's pretty easy to get "NetworkCallback was not registered" error when disconnecting from a local network which is unhandled one. The PR handles it and rejects returned promise if it has been thrown.

SamakaCD avatar Jun 15 '23 06:06 SamakaCD

Thank you for this pull request. I think the disconnect func will always has an error when there's NetworkCallback registered so it's better to just resolve it silently in catch instead of throwing an error. What do you think?

aboozaid avatar Jun 16 '23 12:06 aboozaid

Need to investigate why it throws the error. I guess, that's because unregisterNetworkCallback is called once the app connects. Why do we do so instead of bindProcessToNetwork? I understand that there's a good reason for that since bindProcessToNetwork was used previously.

SamakaCD avatar Jun 16 '23 13:06 SamakaCD

Need to investigate why it throws the error. I guess, that's because unregisterNetworkCallback is called once the app connects. Why do we do so instead of bindProcessToNetwork? I understand that there's a good reason for that since bindProcessToNetwork was used previously.

Sorry I meant when you don't have a NetworkCallback registered it will always throws an error

aboozaid avatar Jun 16 '23 14:06 aboozaid