Determine if app is installed from URL scheme

Just wondering if this is at all possible.
I’m trying to launch my app via a web link using the url scheme defined in the manifest. From what i’ve read, it will throw a nasty error if the app is not installed. Is there anyway i can find out if the app is installed - and then launch the app - or if it’s not installed, go to the Play store?

Thanks

Do you really need the URL? If you know the app, you can query the intent with package name