Skip to content

API Reference: Error Handlers

certmonitor.error_handlers

ErrorHandler

Class for handling errors in a flexible manner.

handle_error staticmethod

handle_error(error_type: str, message: str, host: str, port: int) -> dict

Handles errors encountered during certificate retrieval.

Parameters:

Name Type Description Default
error_type str

The type of error.

required
message str

The error message.

required
host str

The host where the error occurred.

required
port int

The port where the error occurred.

required

Returns:

Name Type Description
dict dict

A dictionary containing the error details.

Source code in certmonitor/error_handlers.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
@staticmethod
def handle_error(error_type: str, message: str, host: str, port: int) -> dict:
    """
    Handles errors encountered during certificate retrieval.

    Args:
        error_type (str): The type of error.
        message (str): The error message.
        host (str): The host where the error occurred.
        port (int): The port where the error occurred.

    Returns:
        dict: A dictionary containing the error details.
    """
    return {
        "error": error_type,
        "message": message,
        "host": host,
        "port": port,
    }