Skip to content

rnet.exceptions

All exception types that can be raised by rnet.

rnet.exceptions

HTTP Client Exceptions

This module defines all exceptions that can be raised by the rnet HTTP client. The exceptions are organized into logical categories based on their cause and severity, making it easier to handle specific types of errors appropriately.

RustPanic

Bases: Exception

A panic occurred in the underlying Rust code.

Source code in rnet/exceptions.py
class RustPanic(Exception):
    r"""
    A panic occurred in the underlying Rust code.
    """

TlsError

Bases: Exception

An error occurred in the TLS security layer.

This exception covers TLS/SSL related issues such as: - Certificate verification failures - TLS handshake failures - Protocol version mismatches - Cipher suite negotiations

Source code in rnet/exceptions.py
class TlsError(Exception):
    r"""
    An error occurred in the TLS security layer.

    This exception covers TLS/SSL related issues such as:
    - Certificate verification failures
    - TLS handshake failures
    - Protocol version mismatches
    - Cipher suite negotiations
    """

ConnectionError

Bases: Exception

An error occurred while establishing a connection.

This exception is raised when the client cannot establish a TCP connection to the remote server. Common causes include: - Server is unreachable - Port is closed or blocked - Network connectivity issues - Firewall blocking the connection

Source code in rnet/exceptions.py
class ConnectionError(Exception):
    r"""
    An error occurred while establishing a connection.

    This exception is raised when the client cannot establish a
    TCP connection to the remote server. Common causes include:
    - Server is unreachable
    - Port is closed or blocked
    - Network connectivity issues
    - Firewall blocking the connection
    """

ProxyConnectionError

Bases: Exception

An error occurred while connecting through a proxy server.

This exception is raised when the client cannot establish a connection to the target server via the specified proxy. Common causes include: - Invalid proxy address or port - Proxy server is unreachable - Authentication failures with the proxy - Network connectivity issues between client and proxy

Source code in rnet/exceptions.py
class ProxyConnectionError(Exception):
    r"""
    An error occurred while connecting through a proxy server.

    This exception is raised when the client cannot establish a
    connection to the target server via the specified proxy. Common
    causes include:
    - Invalid proxy address or port
    - Proxy server is unreachable
    - Authentication failures with the proxy
    - Network connectivity issues between client and proxy
    """

ConnectionResetError

Bases: Exception

The connection was reset by the remote peer.

This exception occurs when an established connection is unexpectedly closed by the remote server. This can happen due to server overload, network issues, or server-side connection limits.

Source code in rnet/exceptions.py
class ConnectionResetError(Exception):
    r"""
    The connection was reset by the remote peer.

    This exception occurs when an established connection is
    unexpectedly closed by the remote server. This can happen
    due to server overload, network issues, or server-side
    connection limits.
    """

BodyError

Bases: Exception

An error occurred while processing the body of a request or response.

This exception covers issues with reading, writing, or processing HTTP message bodies, including: - Invalid content encoding - Incomplete body data - Body size limit exceeded

Source code in rnet/exceptions.py
class BodyError(Exception):
    r"""
    An error occurred while processing the body of a request or response.

    This exception covers issues with reading, writing, or processing
    HTTP message bodies, including:
    - Invalid content encoding
    - Incomplete body data
    - Body size limit exceeded
    """

BuilderError

Bases: Exception

An error occurred while building a request or response.

This exception is raised when there are issues constructing HTTP requests or responses, such as: - Invalid header combinations - Malformed request parameters - Configuration conflicts

Source code in rnet/exceptions.py
class BuilderError(Exception):
    r"""
    An error occurred while building a request or response.

    This exception is raised when there are issues constructing
    HTTP requests or responses, such as:
    - Invalid header combinations
    - Malformed request parameters
    - Configuration conflicts
    """

DecodingError

Bases: Exception

An error occurred while decoding a response.

This exception covers failures in decoding response content, including: - Character encoding issues (UTF-8, Latin-1, etc.) - Compression decompression failures (gzip, deflate, etc.) - Content format parsing errors

Source code in rnet/exceptions.py
class DecodingError(Exception):
    r"""
    An error occurred while decoding a response.

    This exception covers failures in decoding response content,
    including:
    - Character encoding issues (UTF-8, Latin-1, etc.)
    - Compression decompression failures (gzip, deflate, etc.)
    - Content format parsing errors
    """

StatusError

Bases: Exception

An error occurred while processing the status code of a response.

This exception is typically raised for HTTP error status codes (4xx, 5xx) when automatic error handling is enabled, or when there are issues interpreting the status line.

Source code in rnet/exceptions.py
class StatusError(Exception):
    r"""
    An error occurred while processing the status code of a response.

    This exception is typically raised for HTTP error status codes
    (4xx, 5xx) when automatic error handling is enabled, or when
    there are issues interpreting the status line.
    """

RequestError

Bases: Exception

An error occurred while making a request.

This is a general exception for request-related issues that don't fit into more specific categories. It covers various problems during the request lifecycle.

Source code in rnet/exceptions.py
class RequestError(Exception):
    r"""
    An error occurred while making a request.

    This is a general exception for request-related issues that
    don't fit into more specific categories. It covers various
    problems during the request lifecycle.
    """

RedirectError

Bases: Exception

An error occurred while following a redirect.

This exception is raised when there are issues with HTTP redirects, such as: - Too many redirects (redirect loop) - Invalid redirect location - Cross-protocol redirects when not allowed - Redirect limit exceeded

Source code in rnet/exceptions.py
class RedirectError(Exception):
    r"""
    An error occurred while following a redirect.

    This exception is raised when there are issues with HTTP
    redirects, such as:
    - Too many redirects (redirect loop)
    - Invalid redirect location
    - Cross-protocol redirects when not allowed
    - Redirect limit exceeded
    """

UpgradeError

Bases: Exception

An error occurred while upgrading a connection.

This exception covers failures when upgrading HTTP connections to other protocols, such as: - WebSocket upgrade failures - HTTP/2 upgrade issues - Protocol negotiation errors

Source code in rnet/exceptions.py
class UpgradeError(Exception):
    r"""
    An error occurred while upgrading a connection.

    This exception covers failures when upgrading HTTP connections
    to other protocols, such as:
    - WebSocket upgrade failures
    - HTTP/2 upgrade issues
    - Protocol negotiation errors
    """

WebSocketError

Bases: Exception

An error occurred while handling a WebSocket connection.

This exception covers WebSocket-specific issues including: - WebSocket handshake failures - Frame parsing errors - Connection state violations - Message sending/receiving errors

Source code in rnet/exceptions.py
class WebSocketError(Exception):
    r"""
    An error occurred while handling a WebSocket connection.

    This exception covers WebSocket-specific issues including:
    - WebSocket handshake failures
    - Frame parsing errors
    - Connection state violations
    - Message sending/receiving errors
    """

TimeoutError

Bases: Exception

A timeout occurred while waiting for a response.

This exception is raised when operations exceed their configured time limits, including: - Connection timeout (time to establish connection) - Read timeout (time to receive response) - Total request timeout (entire request lifecycle)

Timeouts can often be resolved by increasing timeout values or retrying the request.

Source code in rnet/exceptions.py
class TimeoutError(Exception):
    r"""
    A timeout occurred while waiting for a response.

    This exception is raised when operations exceed their configured
    time limits, including:
    - Connection timeout (time to establish connection)
    - Read timeout (time to receive response)
    - Total request timeout (entire request lifecycle)

    Timeouts can often be resolved by increasing timeout values
    or retrying the request.
    """