Improve value error exception message

This commit is contained in:
Pedro 2023-11-15 17:06:51 +01:00
parent 1ed281e7c4
commit af80565acd

View file

@ -85,7 +85,9 @@ class CONFIG:
for section in data:
for setting in data[section]:
if not isinstance(data[section][setting], self.config_types[section][setting]):
raise ValueError(f"{section}.{setting} must be {self.config_types[section][setting]}")
message = (f"{section}.{setting} must be {self.config_types[section][setting]}."
f" '{data[section][setting]}' {type(data[section][setting])} given.")
raise ValueError(message)
# Handle special setting data type conversion
# is_writing means data from a dict being writen to the config file