3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

conf: when config loading fails, show an error /before/ quitting

This fixes a regression from 2b346e3c01.
This commit is contained in:
James Lu 2017-07-17 07:55:29 -07:00
parent cc9025a080
commit 7e8ff51646

View File

@ -123,13 +123,14 @@ def loadConf(filename, errors_fatal=True, logger=None):
except Exception as e:
e = 'Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e)
if errors_fatal:
sys.exit(1)
elif logger: # Prefer using the Python logger when available
if logger: # Prefer using the Python logger when available
logger.exception(e)
else: # Otherwise, fall back to a print() call.
print('ERROR: %s' % e, file=sys.stderr)
if errors_fatal:
sys.exit(1)
raise
else:
return conf