Skip to content

Exceptions

EOSCClientError

Bases: EOSCError

Raised for 4xx client-side HTTP errors (e.g., invalid request, authentication issues).

Source code in eosc_data_transfer_client/exceptions.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class EOSCClientError(EOSCError):
    """Raised for 4xx client-side HTTP errors (e.g., invalid request, authentication issues)."""

    def __init__(self, status_code, message, response=None):
        """
        Initialize a client error.

        Args:
            status_code (int): HTTP status code.
            message (str): Error message from the server or client.
            response (object, optional): Full response object from the request library.
        """
        self.status_code = status_code
        self.message = message
        self.response = response
        super().__init__(f"[{status_code}] Client Error: {message}")

__init__(status_code, message, response=None)

Initialize a client error.

Parameters:

Name Type Description Default
status_code int

HTTP status code.

required
message str

Error message from the server or client.

required
response object

Full response object from the request library.

None
Source code in eosc_data_transfer_client/exceptions.py
25
26
27
28
29
30
31
32
33
34
35
36
37
def __init__(self, status_code, message, response=None):
    """
    Initialize a client error.

    Args:
        status_code (int): HTTP status code.
        message (str): Error message from the server or client.
        response (object, optional): Full response object from the request library.
    """
    self.status_code = status_code
    self.message = message
    self.response = response
    super().__init__(f"[{status_code}] Client Error: {message}")

EOSCError

Bases: Exception

Base exception for EOSC Data Transfer client.

All custom exceptions inherit from this class.

Source code in eosc_data_transfer_client/exceptions.py
15
16
17
18
19
20
class EOSCError(Exception):
    """Base exception for EOSC Data Transfer client.

    All custom exceptions inherit from this class.
    """
    pass

EOSCRequestError

Bases: EOSCError

Raised for request failures like timeouts, network issues, or invalid URLs.

Source code in eosc_data_transfer_client/exceptions.py
56
57
58
59
60
61
62
63
64
65
class EOSCRequestError(EOSCError):
    """Raised for request failures like timeouts, network issues, or invalid URLs."""
    def __init__(self, message):
        """
        Initialize a request error.

        Args:
            message (str): A description of the request failure.
        """
        super().__init__(f"Request failed: {message}")

__init__(message)

Initialize a request error.

Parameters:

Name Type Description Default
message str

A description of the request failure.

required
Source code in eosc_data_transfer_client/exceptions.py
58
59
60
61
62
63
64
65
def __init__(self, message):
    """
    Initialize a request error.

    Args:
        message (str): A description of the request failure.
    """
    super().__init__(f"Request failed: {message}")

EOSCServerError

Bases: EOSCError

Raised for 5xx server-side HTTP errors.

Source code in eosc_data_transfer_client/exceptions.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class EOSCServerError(EOSCError):
    """Raised for 5xx server-side HTTP errors."""

    def __init__(self, status_code, message, response=None):
        """
        Initialize a server error.

        Args:
            status_code (int): HTTP status code.
            message (str): Error message returned from the server.
            response (object, optional): Full response object from the request library.
        """
        self.status_code = status_code
        self.message = message
        self.response = response
        super().__init__(f"[{status_code}] Server Error: {message}")

__init__(status_code, message, response=None)

Initialize a server error.

Parameters:

Name Type Description Default
status_code int

HTTP status code.

required
message str

Error message returned from the server.

required
response object

Full response object from the request library.

None
Source code in eosc_data_transfer_client/exceptions.py
42
43
44
45
46
47
48
49
50
51
52
53
54
def __init__(self, status_code, message, response=None):
    """
    Initialize a server error.

    Args:
        status_code (int): HTTP status code.
        message (str): Error message returned from the server.
        response (object, optional): Full response object from the request library.
    """
    self.status_code = status_code
    self.message = message
    self.response = response
    super().__init__(f"[{status_code}] Server Error: {message}")