added a try/catch around the XML parsing and an error log
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 26 Jul 2007 20:30:52 +0000 (20:30 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 26 Jul 2007 20:30:52 +0000 (20:30 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1060 9efc2488-bf62-4759-914b-345cdb29e865

src/python/osrf/gateway.py

index a3d8215..ee2fd36 100644 (file)
@@ -2,6 +2,7 @@ from xml.dom import minidom
 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 @@ class XMLGatewayRequest(GatewayRequest):
         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):