Giter Site home page Giter Site logo

Comments (5)

masterwok avatar masterwok commented on May 23, 2024

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.

from simple-torrent-android.

z1zong avatar z1zong commented on May 23, 2024

Sorry, I did state the issue clearly.
this function is called by your SDK after I execute:

 AsyncTask.execute(new Runnable() {
                @Override
                public void run() {
                        torrentSession.start(context, url);
                }
            });

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.
I'm just suggesting that it will be better and an improvement that any errors related to url should be put in TorrentSessionListener.class

@Override
        public void onTorrentError(@NotNull TorrentHandle torrentHandle, @NotNull TorrentSessionStatus torrentSessionStatus) {
            
        }

Thanks for your reply. :)

from simple-torrent-android.

masterwok avatar masterwok commented on May 23, 2024

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
        }
    }
});

from simple-torrent-android.

z1zong avatar z1zong commented on May 23, 2024

Thanks for your reply.
I will try this way, or find other ways.

from simple-torrent-android.

masterwok avatar masterwok commented on May 23, 2024

No problem, good luck!

from simple-torrent-android.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.