Improve error message for invalid entry name in node config
Actually there is:
raise KeyError("Wrong config entry name")
But when user see this error, it's hard to figure out which key were passed (example here: https://gitlab.syncad.com/hive/hive/-/jobs/297134).
Something like this would be much easier to work with:
raise KeyError(f'Invalid config entry name "{key_to_check}".')
Consider also provide additional context. This function is used only in following call chain:
-
Node.dump_config
, -
NodeConfig.load_from_file
, -
NodeConfig.load_from_lines
, -
NodeConfig.__check_if_key_from_file_is_valid
.
Exception can be catched on Node.dump_config
level and provide description such as Node dumped config with entry not known to TestTools
and this description can be followed by above Invalid config entry name "some_invalid_name"
. It can be achieved by raise Exception() from previous_exception
.
Edited by Piotr Batko