-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvement: TorrentSession.kt #6
Comments
Thanks, I'm glad you are finding it useful. If I were you, I'd try/catch the portion of your application code that results in this function being executed and crashing down the line. This way your application can catch the exception and let the user know they provided an invalid path. |
Sorry, I did state the issue clearly.
some users cannot connect to our host due to internet censorship, and this method (torrentSession.start(context, url)) cause a crash instead of throwing exceptions in callback listener.
Thanks for your reply. :) |
Thanks for the suggestion. Unfortunately, we can't use onTorrentError(...) callback as there is no TorrentHandle or TorrentSessionStatus instances available at this time. Even if we could, these callbacks are really just bubbling up events from the underlying jlibtorrent implementation so I wouldn't want to overload them. Would the following work for your use case? AsyncTask.execute(new Runnable() {
@Override
public void run() {
try {
torrentSession.start(context, url);
catch(ex: Exception) {
// Take action to notify the user something went wrong
}
}
}); |
Thanks for your reply. |
No problem, good luck! |
First, It's a very great SDK and easy to use.
However, I notice some fatal errors in our app's firebase log related to
line 303 to line 326:
I'm guessing that when hostname is not available or somehow url not correct, this method will cause uncaught exceptions: net.ConnectException - Failed to connect to ${some url}. Is it better to put a tray-catch block to catch these exceptions?
The text was updated successfully, but these errors were encountered: