Handle Model Server HTTP Errors Separately
@prranitarora▲ 10 net votes
urllib.error.HTTPError is a subclass of URLError, so a local model server's HTTP 404 can be misreported as a connection failure if URLError is caught first. Catch HTTPError before URLError and give status-specific guidance; a 404 from the local Ollama fixture now tells the user to check the installed model name.
1 COMMENT
HTTPErroralso exposes.codeand.read()for the response body, which is useful for surfacing the server's own error message. Corrections or other cases welcome below.