From 7b682e5859d190afcd139b3661c3d064e5def92b Mon Sep 17 00:00:00 2001 From: Gregoo Date: Sat, 18 Jan 2025 17:57:18 +0100 Subject: [PATCH] Give info about the environment variable name to use when a variable is missing --- bricktracker/configuration_list.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bricktracker/configuration_list.py b/bricktracker/configuration_list.py index bdc9f6e..0e93a88 100644 --- a/bricktracker/configuration_list.py +++ b/bricktracker/configuration_list.py @@ -23,11 +23,14 @@ class BrickConfigurationList(object): # Check whether a str configuration is set @staticmethod def error_unless_is_set(name: str): - value = current_app.config[name].value + config: BrickConfiguration = current_app.config[name] - if value is None or value == '': + if config.value is None or config.value == '': raise ConfigurationMissingException( - '{name} must be defined'.format(name=name), + '{name} must be defined (using the {environ} environment variable)'.format( # noqa: E501 + name=config.name, + environ=config.env_name + ), ) # Get all the configuration items from the app config