Improve handling of HTTP errors in search