Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@

logger = logging.getLogger(__name__)

HTTPX_NETWORK_ERROR_TYPES = {
"ConnectError",
"TimeoutException",
"NetworkError",
"ReadTimeout",
"WriteTimeout",
}


class ExceptionConverter:
"""
Expand Down Expand Up @@ -134,14 +142,7 @@ def _is_httpx_status_error(e: Exception) -> bool:

def _is_httpx_network_error(e: Exception) -> bool:
"""Check if exception is an httpx network-related error."""
error_types = (
"ConnectError",
"TimeoutException",
"NetworkError",
"ReadTimeout",
"WriteTimeout",
)
return type(e).__name__ in error_types
return type(e).__name__ in HTTPX_NETWORK_ERROR_TYPES


def _convert_unexpected_status_to_api_exception(e: Exception) -> SandboxApiException:
Expand Down