Fixed to catch our SOAPpy errors.

This commit is contained in:
Jeremy Fincher 2004-09-30 14:53:22 +00:00
parent e360856ac3
commit 567cd195d3

View File

@ -44,7 +44,7 @@ import socket
import urllib import urllib
import xml.sax import xml.sax
import SOAP import SOAPpy
import google import google
import supybot.registry as registry import supybot.registry as registry
@ -116,17 +116,18 @@ def search(log, queries, **kwargs):
raise callbacks.Error, 'Connection timed out to Google.com.' raise callbacks.Error, 'Connection timed out to Google.com.'
else: else:
raise callbacks.Error, 'Error connecting to Google.com.' raise callbacks.Error, 'Error connecting to Google.com.'
except SOAP.HTTPError, e: except SOAPpy.HTTPError, e:
log.info('HTTP Error accessing Google: %s', e) log.info('HTTP Error accessing Google: %s', e)
raise callbacks.Error, 'Error connecting to Google.com.' raise callbacks.Error, 'Error connecting to Google.com.'
except SOAP.faultType, e: except SOAPpy.faultType, e:
log.exception('Uncaught SOAP error:') if 'Invalid authorization key' not in e.faultstring:
log.exception('Unexpected SOAPpy error:')
raise callbacks.Error, 'Invalid Google license key.' raise callbacks.Error, 'Invalid Google license key.'
except xml.sax.SAXException, e: except xml.sax.SAXException, e:
log.exception('Uncaught SAX error:') log.exception('Uncaught SAX error:')
raise callbacks.Error, 'Google returned an unparsable response. ' \ raise callbacks.Error, 'Google returned an unparsable response. ' \
'The full traceback has been logged.' 'The full traceback has been logged.'
except SOAP.Error, e: except SOAPpy.Error, e:
log.exception('Uncaught SOAP exception in Google.search:') log.exception('Uncaught SOAP exception in Google.search:')
raise callbacks.Error, 'Error connecting to Google.com.' raise callbacks.Error, 'Error connecting to Google.com.'