make google translate return detailed google error, instead of the unhelpful "we broke google".

This commit is contained in:
Daniel Folkinshteyn 2010-04-11 18:27:39 -04:00 committed by Valentin Lorentz
parent 8d45228642
commit bf6f0e2d18

View File

@ -294,7 +294,8 @@ class Google(callbacks.PluginRegexp):
json = simplejson.load(fd) json = simplejson.load(fd)
fd.close() fd.close()
if json['responseStatus'] != 200: if json['responseStatus'] != 200:
raise callbacks.Error, 'We broke The Google!' raise callbacks.Error, 'Google says: Response Status %s: %s.' % \
(json['responseStatus'], json['responseDetails'],)
if fromLang != '': if fromLang != '':
irc.reply(json['responseData']['translatedText'].encode('utf-8')) irc.reply(json['responseData']['translatedText'].encode('utf-8'))
else: else: