GithubHelp home page GithubHelp logo

Comments (3)

edwardstumpf avatar edwardstumpf commented on August 18, 2024

It would be better to only trigger the failure callback for exceptions related to protocols. The successCb function may also throw an exception, so you wouldn't want to call failCb in that case.

} catch (e) {
  // Catch errors for either unknown protocols or registered protocols where the associated application isn't installed
  if (e.name == "NS_ERROR_UNKNOWN_PROTOCOL" || e.name == "NS_ERROR_FAILURE") {
    failCb();
  }
}

from custom-protocol-detection.

mafar avatar mafar commented on August 18, 2024

@edwardstumpf
Yes may be but NS_ERROR_FAILURE indicates protocol might be reigstered but app could not be launched for some reason ( may be exe was moved or does not exist at that path)

See another implementation here.
https://gist.github.com/aaronk6/d801d750f14ac31845e8

They put it in unknown callback for this reason

from custom-protocol-detection.

edwardstumpf avatar edwardstumpf commented on August 18, 2024

I agree that the failure callback should be triggered if the exception throw is NS_ERROR_FAILURE. As you said, this indicates that the application associated with the protocol isn't at the expected location. This could mean that there's an issue with the custom protocol (the wrong path for the application was used) or the application doesn't exist at that location (uninstalled, etc.)

I don't agree that all exception name checking should be removed. The success callback could also throw an exception; this exception would have nothing to do with protocol checking, so the library shouldn't catch that exception.

from custom-protocol-detection.

Related Issues (20)

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.