Move config validation exception logging to bootstrap + humanize
This commit is contained in:
parent
f904d06c9a
commit
9fa1328111
2 changed files with 23 additions and 23 deletions
|
@ -152,23 +152,6 @@ def time_period_str(value: str) -> timedelta:
|
|||
time_period = vol.Any(time_period_str, timedelta, time_period_dict)
|
||||
|
||||
|
||||
def log_exception(logger, ex, domain, config):
|
||||
"""Generate log exception for config validation."""
|
||||
message = 'Invalid config for [{}]: '.format(domain)
|
||||
if 'extra keys not allowed' in ex.error_message:
|
||||
message += '[{}] is an invalid option for [{}]. Check: {}->{}.'\
|
||||
.format(ex.path[-1], domain, domain,
|
||||
'->'.join('%s' % m for m in ex.path))
|
||||
else:
|
||||
message += str(ex)
|
||||
|
||||
if hasattr(config, '__line__'):
|
||||
message += " (See {}:{})".format(config.__config_file__,
|
||||
config.__line__ or '?')
|
||||
|
||||
logger.error(message)
|
||||
|
||||
|
||||
def match_all(value):
|
||||
"""Validator that matches all values."""
|
||||
return value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue