Show example (when available) for "invalid value" error

This commit is contained in:
jesopo 2019-06-14 17:35:12 +01:00
parent 229a45a491
commit e814494777

View file

@ -169,7 +169,12 @@ class Module(ModuleManager.BaseModule):
try:
result = self._config(export_settings, target, setting, value)
except ConfigInvalidValue:
raise utils.EventError("Invalid value")
example = setting_info.get("example", None)
if not example == None:
raise utils.EventError("Invalid value. Example: %s" %
example)
else:
raise utils.EventError("Invalid value")
except ConfigSettingInexistent:
raise utils.EventError("Setting not set")