Better error handling when server is unavailable or authentication is required.