fix error location
This commit is contained in:
parent
b51dddc8d8
commit
d15b580c1d
1 changed files with 9 additions and 16 deletions
|
|
@ -144,7 +144,7 @@ class Preset(StrictDictValidator):
|
||||||
return plugins
|
return plugins
|
||||||
|
|
||||||
def __validate_override_string_formatter_validator(
|
def __validate_override_string_formatter_validator(
|
||||||
self, formatter_validator: OverridesStringFormatterValidator, validator_name: str
|
self, formatter_validator: OverridesStringFormatterValidator
|
||||||
):
|
):
|
||||||
# Gather all resolvable override variables
|
# Gather all resolvable override variables
|
||||||
resolvable_override_variables: List[str] = []
|
resolvable_override_variables: List[str] = []
|
||||||
|
|
@ -157,18 +157,17 @@ class Preset(StrictDictValidator):
|
||||||
|
|
||||||
for variable_name in formatter_validator.format_variables:
|
for variable_name in formatter_validator.format_variables:
|
||||||
if variable_name not in resolvable_override_variables:
|
if variable_name not in resolvable_override_variables:
|
||||||
raise self._validation_exception(
|
# pylint: disable=protected-access
|
||||||
f"Validation error in {validator_name}: "
|
raise StringFormattingVariableNotFoundException(
|
||||||
f"This variable can only use override variables that resolve without needing "
|
f"Validation error in {formatter_validator._name}: "
|
||||||
f"variables from a downloaded file. The only override variables defined that "
|
f"This can only use override variables. Available override variables are: "
|
||||||
f"meet this condition are: {', '.join(sorted(resolvable_override_variables))}",
|
f"{', '.join(sorted(resolvable_override_variables))}",
|
||||||
exception_class=StringFormattingVariableNotFoundException,
|
|
||||||
)
|
)
|
||||||
|
# pylint: enable=protected-access
|
||||||
|
|
||||||
def __recursive_preset_validate(
|
def __recursive_preset_validate(
|
||||||
self,
|
self,
|
||||||
validator_dict: Optional[Dict[str, Validator]] = None,
|
validator_dict: Optional[Dict[str, Validator]] = None,
|
||||||
validator_name: Optional[str] = None,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Ensure all OverridesStringFormatterValidator's only contain variables from the overrides
|
Ensure all OverridesStringFormatterValidator's only contain variables from the overrides
|
||||||
|
|
@ -176,22 +175,16 @@ class Preset(StrictDictValidator):
|
||||||
"""
|
"""
|
||||||
if validator_dict is None:
|
if validator_dict is None:
|
||||||
validator_dict = self._validator_dict
|
validator_dict = self._validator_dict
|
||||||
validator_name = self.name
|
|
||||||
|
|
||||||
for validator in validator_dict.values():
|
for validator in validator_dict.values():
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
# Usage of protected variables in other validators is fine. The reason to keep them
|
# Usage of protected variables in other validators is fine. The reason to keep them
|
||||||
# protected is for readability when using them in subscriptions.
|
# protected is for readability when using them in subscriptions.
|
||||||
_validator_name = f"{validator_name}.{validator._name}"
|
|
||||||
if isinstance(validator, DictValidator):
|
if isinstance(validator, DictValidator):
|
||||||
self.__recursive_preset_validate(
|
self.__recursive_preset_validate(validator._validator_dict)
|
||||||
validator._validator_dict, validator_name=_validator_name
|
|
||||||
)
|
|
||||||
|
|
||||||
if isinstance(validator, OverridesStringFormatterValidator):
|
if isinstance(validator, OverridesStringFormatterValidator):
|
||||||
self.__validate_override_string_formatter_validator(
|
self.__validate_override_string_formatter_validator(validator)
|
||||||
validator, validator_name=_validator_name
|
|
||||||
)
|
|
||||||
# pylint: enable=protected-access
|
# pylint: enable=protected-access
|
||||||
|
|
||||||
def __merge_parent_preset_dicts_if_present(self, config: ConfigFile):
|
def __merge_parent_preset_dicts_if_present(self, config: ConfigFile):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue