The mongo shell attempts to authenticate right after it connects to a server and returns an exception if it's unable to. This means that if the client credentials are invalid, it will interpret that as a connection failure and raise an exception.
It is unexpected that the shell would conflate an authentication problem with the general class of network connection failures. Here's what clients see when all that's wrong is invalid credentials:
It's unclear to me if this is expected behavior (it's confusing at best). If so, using a more generic error message instead of specifically offering that clients check their IP allowlist would be less confusing to users. If not, we should fix it.