Skip to content

declearn.main.utils.AggregationError

Bases: Exception

Custom Exception, used to wrap data-info-aggregation failure info.

Source code in declearn/main/utils/_data_info.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class AggregationError(Exception):
    """Custom Exception, used to wrap data-info-aggregation failure info."""

    def __init__(
        self,
        error: str,
        messages: Dict[str, str],
    ) -> None:
        """Instantiate the AggregationError, wrapping error information.

        Parameters
        ----------
        error: str
            General error message reporting on the reasons for which
            client-wise data-info aggregation failed.
        messages: dict[str, str]
            Client-wise error messages reporting on the reason for
            which data-info aggregation failed, formatted as a
            `{client_name: error_msg}` dict.

        Note
        ----
        The `error` and `messages` arguments are available as attributes,
        effectively making this exception a wrapper to pass information.
        """
        super().__init__(error, messages)
        self.error = error
        self.messages = messages

    def __str__(
        self,
    ) -> str:
        return self.error

__init__(error, messages)

Instantiate the AggregationError, wrapping error information.

Parameters:

Name Type Description Default
error str

General error message reporting on the reasons for which client-wise data-info aggregation failed.

required
messages Dict[str, str]

Client-wise error messages reporting on the reason for which data-info aggregation failed, formatted as a {client_name: error_msg} dict.

required

Note

The error and messages arguments are available as attributes, effectively making this exception a wrapper to pass information.

Source code in declearn/main/utils/_data_info.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def __init__(
    self,
    error: str,
    messages: Dict[str, str],
) -> None:
    """Instantiate the AggregationError, wrapping error information.

    Parameters
    ----------
    error: str
        General error message reporting on the reasons for which
        client-wise data-info aggregation failed.
    messages: dict[str, str]
        Client-wise error messages reporting on the reason for
        which data-info aggregation failed, formatted as a
        `{client_name: error_msg}` dict.

    Note
    ----
    The `error` and `messages` arguments are available as attributes,
    effectively making this exception a wrapper to pass information.
    """
    super().__init__(error, messages)
    self.error = error
    self.messages = messages