SNAP Apply-Orbit: how to determine if orbit files are available before Apply-Orbit

Periodically when we process newly released Sentinel-1 products we get the orbit file not available error.

Is there a way to check if the orbit file(s) for a particular product is available before we start processing the product?

I have tried to query ahead of time the available orbit files and note the endingDateTime of the most recent orbit file. Then I only process Sentinel-1 products whose endingDateTime is older than that.

The approach does not seem to work all the time.

Any ideas?