[Opensrf-commits] r1060 - trunk/src/python/osrf

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 26 16:32:01 EDT 2007


Author: erickson
Date: 2007-07-26 16:30:52 -0400 (Thu, 26 Jul 2007)
New Revision: 1060

Modified:
   trunk/src/python/osrf/gateway.py
Log:
added a try/catch around the XML parsing and an error log

Modified: trunk/src/python/osrf/gateway.py
===================================================================
--- trunk/src/python/osrf/gateway.py	2007-07-26 20:30:16 UTC (rev 1059)
+++ trunk/src/python/osrf/gateway.py	2007-07-26 20:30:52 UTC (rev 1060)
@@ -2,6 +2,7 @@
 from xml.sax import handler, make_parser, saxutils
 from json import *
 from net_obj import *
+from log import *
 import urllib, urllib2, sys, re
 
 defaultHost = None
@@ -91,7 +92,12 @@
         handler = XMLGatewayParser()
         parser = make_parser()
         parser.setContentHandler(handler)
-        parser.parse(response)
+        try:
+            parser.parse(response)
+        except Exception, e:
+            osrfLogErr('Error parsing gateway XML: %s' % str(e))
+            return None
+
         return handler.getResult()
 
     def encodeParam(self, param):



More information about the opensrf-commits mailing list