Prettify error message

This commit is contained in:
Markus Unterwaditzer 2014-12-17 14:29:09 +01:00
parent 625cb4adde
commit 4aab600e7c

View file

@ -54,10 +54,11 @@ class JobFailed(RuntimeError):
def validate_section_name(name, section_type): def validate_section_name(name, section_type):
invalid = set(name) - SECTION_NAME_CHARS invalid = set(name) - SECTION_NAME_CHARS
if invalid: if invalid:
chars_display = ''.join(sorted(SECTION_NAME_CHARS))
raise CliError('The {}-section {!r} contains invalid characters. Only ' raise CliError('The {}-section {!r} contains invalid characters. Only '
'the following characters are allowed for storage and ' 'the following characters are allowed for storage and '
'pair names:\n{}'.format(section_type, name, 'pair names:\n{}'.format(section_type, name,
SECTION_NAME_CHARS)) chars_display))
def _parse_old_config_list_value(d, key): def _parse_old_config_list_value(d, key):