Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added httpcore.SSLError and redirect TLS handshake errors to it. #960

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

- Added httpcore.SSLError and redirect TLS handshake errors to it. (#960)

## Version 1.0.6 (October 1st, 2024)

- Relax `trio` dependency pinning. (#956)
Expand Down
1 change: 1 addition & 0 deletions docs/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The following exceptions may be raised when sending a request:
* `httpcore.WriteTimeout`
* `httpcore.NetworkError`
* `httpcore.ConnectError`
* `httpcore.SSLError`
* `httpcore.ReadError`
* `httpcore.WriteError`
* `httpcore.ProtocolError`
Expand Down
2 changes: 2 additions & 0 deletions httpcore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ReadError,
ReadTimeout,
RemoteProtocolError,
SSLError,
TimeoutException,
UnsupportedProtocol,
WriteError,
Expand Down Expand Up @@ -128,6 +129,7 @@ def __init__(self, *args, **kwargs): # type: ignore
"ConnectError",
"ReadError",
"WriteError",
"SSLError",
]

__version__ = "1.0.6"
Expand Down
3 changes: 2 additions & 1 deletion httpcore/_backends/anyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ConnectTimeout,
ReadError,
ReadTimeout,
SSLError,
WriteError,
WriteTimeout,
map_exceptions,
Expand Down Expand Up @@ -64,7 +65,7 @@ async def start_tls(
TimeoutError: ConnectTimeout,
anyio.BrokenResourceError: ConnectError,
anyio.EndOfStream: ConnectError,
ssl.SSLError: ConnectError,
ssl.SSLError: SSLError,
}
with map_exceptions(exc_map):
try:
Expand Down
5 changes: 5 additions & 0 deletions httpcore/_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import contextlib
import ssl
from typing import Iterator, Mapping, Type

ExceptionMapping = Mapping[Type[Exception], Type[Exception]]
Expand Down Expand Up @@ -79,3 +80,7 @@ class ReadError(NetworkError):

class WriteError(NetworkError):
pass


class SSLError(ssl.SSLError, ConnectError):
pass
Loading