Adds simple handler to provide failed line numbers
Change adds `as err` handler to provide line number, if config yaml fails to parse. Example output [config] ERROR while scanning a simple key in "config.yaml", line 5, column 1 could not find expected ':' in "config.yaml", line 6, column 1 [main] ERROR config.yaml : Error parsing file. Change-Id: If764a123c0dd8871dcd98f58be48c6bf0034f1d4 Closes-Bug: #1621552
This commit is contained in:
parent
d54a65f0f0
commit
05c52da559
@ -49,7 +49,8 @@ class BanditConfig(object):
|
||||
try:
|
||||
self._config = yaml.safe_load(f)
|
||||
self.validate(config_file)
|
||||
except yaml.YAMLError:
|
||||
except yaml.YAMLError as err:
|
||||
LOG.error(err)
|
||||
raise utils.ConfigError("Error parsing file.", config_file)
|
||||
|
||||
# valid config must be a dict
|
||||
|
Loading…
x
Reference in New Issue
Block a user