Adds handling of error returned from URL parsing. Fixes #25714 (cherry picked from commit 58cefe73ee)
58cefe73ee