From 69f6a118749bfe6b14133c4604100a59c7cefb32 Mon Sep 17 00:00:00 2001 From: Hazel Noack Date: Wed, 30 Jul 2025 11:00:18 +0200 Subject: [PATCH] feat: implemented error handling for empty lists --- python_mommy_venv/responses.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/python_mommy_venv/responses.py b/python_mommy_venv/responses.py index 62e27cb..48b463d 100644 --- a/python_mommy_venv/responses.py +++ b/python_mommy_venv/responses.py @@ -103,6 +103,23 @@ def compile_config(disable_requests: bool = False) -> dict: if val is not None: config[key] = val.split("/") + # validate empty variables + empty_values = [] + for key, value in config.items(): + if len(value) == 0: + empty_values.append(key) + if len(empty_values) > 0: + empty_values_sting = ", ".join(empty_values) + mommy_logger.error( + "mommy is very displeased that you didn't config the key(s) %s", + empty_values_sting, + ) + serious_logger.error( + "the following keys have empty values and need to be configured: %s", + empty_values_sting + ) + exit(1) + # validate moods for mood in config["mood"]: if mood not in mood_definitions: