better error message with config.json format
This commit is contained in:
parent
f81d735b5b
commit
34843c6a91
2 changed files with 11 additions and 2 deletions
|
@ -198,7 +198,11 @@ def main():
|
||||||
if config_path:
|
if config_path:
|
||||||
logging.info('loading config from %s' % config_path)
|
logging.info('loading config from %s' % config_path)
|
||||||
with open(config_path, 'rb') as f:
|
with open(config_path, 'rb') as f:
|
||||||
|
try:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
|
except ValueError as e:
|
||||||
|
logging.error('found an error in config.json: %s', e.message)
|
||||||
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
config = {}
|
config = {}
|
||||||
|
|
||||||
|
|
|
@ -150,8 +150,13 @@ def main():
|
||||||
config_path = value
|
config_path = value
|
||||||
|
|
||||||
if config_path:
|
if config_path:
|
||||||
|
logging.info('loading config from %s' % config_path)
|
||||||
with open(config_path, 'rb') as f:
|
with open(config_path, 'rb') as f:
|
||||||
|
try:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
|
except ValueError as e:
|
||||||
|
logging.error('found an error in config.json: %s', e.message)
|
||||||
|
sys.exit(1)
|
||||||
logging.info('loading config from %s' % config_path)
|
logging.info('loading config from %s' % config_path)
|
||||||
else:
|
else:
|
||||||
config = {}
|
config = {}
|
||||||
|
|
Loading…
Reference in a new issue