[svn-commits] sgriepentrog: testsuite/asterisk/trunk r4810 - /asterisk/trunk/lib/python/ast...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Mar 7 15:17:29 CST 2014


Author: sgriepentrog
Date: Fri Mar  7 15:17:25 2014
New Revision: 4810

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4810
Log:
testsuite: improve yaml exception handling

Rather than a single line indicating a yaml parse error,
catch the yaml exception and display a useful diagnostic
detailing what type of error occurred, where in the yaml
file it happened, and also the python backtrace.

Review: https://reviewboard.asterisk.org/r/3287/


Modified:
    asterisk/trunk/lib/python/asterisk/test_config.py

Modified: asterisk/trunk/lib/python/asterisk/test_config.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/test_config.py?view=diff&rev=4810&r1=4809&r2=4810
==============================================================================
--- asterisk/trunk/lib/python/asterisk/test_config.py (original)
+++ asterisk/trunk/lib/python/asterisk/test_config.py Fri Mar  7 15:17:25 2014
@@ -14,6 +14,7 @@
 import subprocess
 import yaml
 import socket
+import traceback
 
 sys.path.append("lib/python")
 
@@ -253,8 +254,12 @@
 
         try:
             self._parse_config()
+        except yaml.YAMLError as e:
+            print("YAML Parse Error: %s" % e)
+            print(traceback.format_exc())
+            self.can_run = False
         except:
-            print "Exception occurred while parsing config:", sys.exc_info()[0]
+            print("Exception occurred while parsing config:", sys.exc_info()[0])
             self.can_run = False
 
     def _process_global_settings(self):




More information about the svn-commits mailing list