Skip to content

Commit

Permalink
Add IncompleteRead
Browse files Browse the repository at this point in the history
  • Loading branch information
perklet committed Aug 3, 2024
1 parent 51e5542 commit 3958899
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions curl_cffi/curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import warnings
from http.cookies import SimpleCookie
from pathlib import Path
from typing import Any, List, Literal, Optional, Tuple, Union
from typing import Any, List, Literal, Optional, Tuple, Union, cast

import certifi

Expand Down Expand Up @@ -143,7 +143,7 @@ def _get_error(self, errcode: int, *args: Any):
return CurlError(
f"Failed to {action}, curl: ({errcode}) {errmsg}. "
"See https://curl.se/libcurl/c/libcurl-errors.html first for more details.",
code=errcode,
code=cast(CurlECod, errcode),
)

def setopt(self, option: CurlOpt, value: Any) -> int:
Expand Down
5 changes: 5 additions & 0 deletions curl_cffi/requests/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class HTTPError(RequestException):
"""An HTTP error occurred."""


class IncompleteRead(HTTPError):
"""Incomplete read of content"""


class ConnectionError(RequestException):
"""A Connection error occurred."""

Expand Down Expand Up @@ -201,6 +205,7 @@ class RequestsDependencyWarning(RequestsWarning):
CurlECode.PROXY: ProxyError,
CurlECode.SSL_CLIENTCERT: SSLError,
CurlECode.ECH_REQUIRED: SSLError,
CurlECode.PARTIAL_FILE: IncompleteRead,
}


Expand Down

0 comments on commit 3958899

Please sign in to comment.