Handle exceptions when global_config is not yet set in fedabipkgdiff
authorDodji Seketeli <dodji@redhat.com>
Mon, 16 Oct 2017 12:02:13 +0000 (14:02 +0200)
committerDodji Seketeli <dodji@redhat.com>
Mon, 16 Oct 2017 12:45:32 +0000 (14:45 +0200)
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>
tools/fedabipkgdiff

index fd66854e22a0107cf9f7553903db554b706e6b72..b8c04f1c7f95c014244a9f4a14e1765ab3e6a6db 100755 (executable)
@@ -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: