Handle exceptions when global_config is not yet set in fedabipkgdiff

Handling an exception in fedabipkgdiff requires that the global_config
object is set because we reference some if its data members.

This patch avoids requiring the global_config object so that users can
still be aware of the reason of the exception when that object is not
yet set.

	* tools/fedabipkgdiff: When handling an exception, if the
	global_config object is not yet set then just let the exception
	through.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2017-10-16 14:02:13 +02:00
parent ae2be278fd
commit d000f75c45

View File

@ -1490,6 +1490,8 @@ if __name__ == '__main__':
try:
sys.exit(main())
except KeyboardInterrupt:
if global_config is None:
raise
if global_config.debug:
logger.debug('Terminate by user')
else:
@ -1499,6 +1501,8 @@ if __name__ == '__main__':
else:
sys.exit(2)
except Exception as e:
if global_config is None:
raise
if global_config.debug:
logger.debug(str(e))
else: