Repository: urllib3/urllib3

Issue:
DNS lookup error exception
I am using `requests` to check domain status for `k8s.io` domains (https://github.com/kubernetes/k8s.io/pull/30) and I can't find a good way to check for DNS lookup error like `ERR_NAME_NOT_RESOLVED` in Chrome. Exceptions output seems platform specific:

```
    Traceback (most recent call last):
      File "check.py", line 11, in <module>
        status = requests.head('http://' + site)
      File "C:\Python27\lib\site-packages\requests\api.py", line 93, in head
        return request('head', url, **kwargs)
      File "C:\Python27\lib\site-packages\requests\api.py", line 53, in request
        return session.request(method=method, url=url, **kwargs)
      File "C:\Python27\lib\site-packages\requests\sessions.py", line 468, in request
        resp = self.send(prep, **send_kwargs)
      File "C:\Python27\lib\site-packages\requests\sessions.py", line 576, in send
        r = adapter.send(request, **kwargs)
      File "C:\Python27\lib\site-packages\requests\adapters.py", line 437, in send
        raise ConnectionError(e, request=request)
    requests.exceptions.ConnectionError: HTTPConnectionPool(host='jenkins.k8s.io', port=80):
        Max retries exceeded with url: / (Caused by
        NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at
        0x029E43B0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
```

So I was redirected here from https://github.com/kennethreitz/requests/issues/3630#issuecomment-255031285 to see if `urllib3` could expose more fine-grained DNSLookupError exception and maybe remove MaxRetryError wrapper.
## 


Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/urllib3/urllib3/pull/2319?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3) Report
> Merging [#2319](https://codecov.io/gh/urllib3/urllib3/pull/2319?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3) (2e05ef8) into [main](https://codecov.io/gh/urllib3/urllib3/commit/7483682a09dc254af93e19a0c32163888ed5d773?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3) (7483682) will **decrease** coverage by `0.44%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/urllib3/urllib3/pull/2319/graphs/tree.svg?width=650&height=150&src=pr&token=UYKHB2uXDn&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3)](https://codecov.io/gh/urllib3/urllib3/pull/2319?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3)

```diff
@@             Coverage Diff             @@
##              main    #2319      +/-   ##
===========================================
- Coverage   100.00%   99.55%   -0.45%     
===========================================
  Files           25       25              
  Lines         2454     2450       -4     
===========================================
- Hits          2454     2439      -15     
- Misses           0       11      +11     
```


| [Impacted Files](https://codecov.io/gh/urllib3/urllib3/pull/2319?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3) | Coverage Δ | |
|---|---|---|
| [src/urllib3/connectionpool.py](https://codecov.io/gh/urllib3/urllib3/pull/2319/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3#diff-c3JjL3VybGxpYjMvY29ubmVjdGlvbnBvb2wucHk=) | `100.00% <ø> (ø)` | |
| [src/urllib3/connection.py](https://codecov.io/gh/urllib3/urllib3/pull/2319/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3#diff-c3JjL3VybGxpYjMvY29ubmVjdGlvbi5weQ==) | `98.82% <100.00%> (-1.18%)` | :arrow_down: |
| [src/urllib3/exceptions.py](https://codecov.io/gh/urllib3/urllib3/pull/2319/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3#diff-c3JjL3VybGxpYjMvZXhjZXB0aW9ucy5weQ==) | `100.00% <100.00%> (ø)` | |
| [src/urllib3/util/wait.py](https://codecov.io/gh/urllib3/urllib3/pull/2319/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3#diff-c3JjL3VybGxpYjMvdXRpbC93YWl0LnB5) | `91.11% <0.00%> (-8.89%)` | :arrow_down: |
| [src/urllib3/contrib/socks.py](https://codecov.io/gh/urllib3/urllib3/pull/2319/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3#diff-c3JjL3VybGxpYjMvY29udHJpYi9zb2Nrcy5weQ==) | `97.29% <0.00%> (-2.71%)` | :arrow_down: |
| [src/urllib3/response.py](https://codecov.io/gh/urllib3/urllib3/pull/2319/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3#diff-c3JjL3VybGxpYjMvcmVzcG9uc2UucHk=) | `99.25% <0.00%> (-0.75%)` | :arrow_down: |
| [src/urllib3/\_collections.py](https://codecov.io/gh/urllib3/urllib3/pull/2319/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3#diff-c3JjL3VybGxpYjMvX2NvbGxlY3Rpb25zLnB5) | `99.42% <0.00%> (-0.58%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/urllib3/urllib3/pull/2319?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/urllib3/urllib3/pull/2319?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3). Last update [7483682...2e05ef8](https://codecov.io/gh/urllib3/urllib3/pull/2319?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=urllib3).


Patch:
diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py
index c7367a97..31eec10c 100644
--- a/src/urllib3/connection.py
+++ b/src/urllib3/connection.py
@@ -207,7 +207,7 @@ class HTTPConnection(_HTTPConnection):
                 socket_options=self.socket_options,
             )
         except socket.gaierror as e:
-            raise NameResolutionError(self.host, e)
+            raise NameResolutionError(self.host, self, e)
         except SocketTimeout:
             raise ConnectTimeoutError(
                 self,
diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py
index 30cb6a30..75bb58f3 100644
--- a/src/urllib3/connectionpool.py
+++ b/src/urllib3/connectionpool.py
@@ -30,7 +30,6 @@ from .exceptions import (
     InsecureRequestWarning,
     LocationValueError,
     MaxRetryError,
-    NameResolutionError,
     NewConnectionError,
     ProtocolError,
     ProxyError,
@@ -739,7 +738,6 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
             SSLError,
             CertificateError,
             HTTPSProxyError,
-            NameResolutionError,
         ) as e:
             # Discard the connection for these exceptions. It will be
             # replaced during the next _get_conn() call.
@@ -747,8 +745,6 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
             new_e: Exception = e
             if isinstance(e, (BaseSSLError, CertificateError)):
                 new_e = SSLError(e)
-            elif isinstance(e, NameResolutionError):
-                pass
             elif isinstance(e, (OSError, NewConnectionError)) and self.proxy:
                 new_e = ProxyError("Cannot connect to proxy.", e)
             elif isinstance(e, (OSError, HTTPException)):
diff --git a/src/urllib3/exceptions.py b/src/urllib3/exceptions.py
index 1eb6ebcc..cba1e6cc 100644
--- a/src/urllib3/exceptions.py
+++ b/src/urllib3/exceptions.py
@@ -184,6 +184,14 @@ class NewConnectionError(ConnectTimeoutError, HTTPError):
         return self.conn
 
 
+class NameResolutionError(NewConnectionError):
+    """Raised when host name resolution fails."""
+
+    def __init__(self, host: str, conn: "HTTPConnection", reason: socket.gaierror):
+        message = f"Failed to resolve '{host}' ({reason})"
+        super().__init__(conn, message)
+
+
 class EmptyPoolError(PoolError):
     """Raised when a pool runs out of connections and no more are allowed."""
 
@@ -379,11 +387,3 @@ class UnrewindableBodyError(HTTPError):
     """urllib3 encountered an error when trying to rewind a body"""
 
     pass
-
-
-class NameResolutionError(HTTPError, socket.gaierror):
-    """Raised when host name resolution fails."""
-
-    def __init__(self, host: str, reason: socket.gaierror):
-        message = f"Failed to resolve '{host}' ({reason})"
-        HTTPError.__init__(self, message)


Test patch:
diff --git a/test/with_dummyserver/test_proxy_poolmanager.py b/test/with_dummyserver/test_proxy_poolmanager.py
index d46f7eb9..76094daa 100644
--- a/test/with_dummyserver/test_proxy_poolmanager.py
+++ b/test/with_dummyserver/test_proxy_poolmanager.py
@@ -16,7 +16,7 @@ from urllib3.exceptions import (
     ConnectTimeoutError,
     HTTPSProxyError,
     MaxRetryError,
-    NameResolutionError,
+    ProxyError,
     ProxySchemeUnknown,
     ProxySchemeUnsupported,
     SSLError,
@@ -146,7 +146,7 @@ class TestHTTPProxyManager(HTTPDummyProxyTestCase):
 
             with pytest.raises(MaxRetryError) as e:
                 http.request("GET", f"{self.http_url}/")
-            assert type(e.value.reason) == NameResolutionError
+            assert type(e.value.reason) == ProxyError
 
     def test_https_conn_failed(self):
         """