Catch additional errors in fetch_url

Fixes #8971