More error messages for config setting

This commit is contained in:
2020-12-19 02:41:44 +01:00
parent ee958971e8
commit 53df5f613f

View File

@@ -76,7 +76,7 @@ def _config_set_in_scope(scope: dict, key: str, value, cfg_type: type) -> str:
if type(value) == cfg_type: if type(value) == cfg_type:
scope[key] = value scope[key] = value
success = True success = True
if type(value) == str: elif type(value) == str:
if cfg_type == int: if cfg_type == int:
scope[key] = int(value) scope[key] = int(value)
success = True success = True
@@ -93,6 +93,10 @@ def _config_set_in_scope(scope: dict, key: str, value, cfg_type: type) -> str:
return 'Unable to convert given value to a boolean!' return 'Unable to convert given value to a boolean!'
scope[key] = value scope[key] = value
success = True success = True
else:
return 'Unknown config type: ' + str(cfg_type)
else:
return 'Unknown given value type: ' + str(type(value))
except (TypeError, ValueError): except (TypeError, ValueError):
success = False success = False
if success: if success: