def send_failure_email()

in src/helper.py [0:0]


def send_failure_email(error_message, add_message=None):
    """This will send and email to an SNS topic about a Lambda Function Failure

    Args:
        error_message (str): Error message the was produced by the Lambda Function
        add_message (str) [optional]: Any additional data that would be added to the Email

    Returns:
        N/A
    """
    logger.info("Sending error message to SNS Topic")
    message = f'''\
                Hello,

                Your Function failed with the following message.

                Error Message: {error_message}

                Additional Data: {add_message} 

                To help further debug your issue...
                AWS_LAMBDA_LOG_GROUP_NAME: {os.environ['AWS_LAMBDA_LOG_GROUP_NAME']}
                AWS_LAMBDA_LOG_STREAM_NAME: {os.environ['AWS_LAMBDA_LOG_STREAM_NAME']}

                Sincerely,
                Your friendly neighborhood cloud architect :)

                '''

    client = boto3.client('sns')
    try:
        response = client.publish(
            TopicArn=os.environ['FAILURE_SNS_TOPIC_ARN'],
            Message=message,
            Subject=f"Execution of Lambda Function:{os.environ['AWS_LAMBDA_FUNCTION_NAME']} failed."
        )
        logger.info(response)

    except Exception as err:
        logger.error(err, exc_info=True)