PATCH: koan: correction to exception handling in main()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Please consider the following patch to koan.

                                                       -gavin...

* Mon Mar 10 2008 Gavin Romig-Koch
- koan/app.py:main(): correct exception handling


This patch fixes (what I believe is an error in) exception handling in 
koan/app.py:main().  The current code (almost) never prints a traceback.
I believe that the intent of the current code was to just print an
error message for InfoExceptions, and a traceback for all other Exceptions.
That's what this change implements.


diff --git a/koan/app.py b/koan/app.py
index 5c6ff6a..ef85d65 100755
--- a/koan/app.py
+++ b/koan/app.py
@@ -191,12 +191,12 @@ def main():
             k.port              = options.port
         k.run()
 
-    except Exception, e:
-        (xa, xb, tb) = sys.exc_info()
-        if str(xb).find("InfoException") != -1:
-            traceback.print_exc()
-        else:
-            print str(xb)
+    except InfoException, e:
+        print e
+
+    except Exception:
+        traceback.print_exc()
+
     return 0
 
 #=======================================================
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux