mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Google: show the API's real error message instead of a generic error
This makes it easier to debug issues like #955 in the future, whether it be session limit exceeded, an API change, etc. Also, remove duplicated checking clause for the HTTP error code.
This commit is contained in:
parent
35d267b498
commit
c99dab4df4
@ -122,7 +122,8 @@ class Google(callbacks.PluginRegexp):
|
|||||||
headers=headers).decode('utf8')
|
headers=headers).decode('utf8')
|
||||||
data = json.loads(text)
|
data = json.loads(text)
|
||||||
if data['responseStatus'] != 200:
|
if data['responseStatus'] != 200:
|
||||||
raise callbacks.Error(_('We broke The Google!'))
|
self.log.info("Google: unhandled error message: ", text)
|
||||||
|
raise callbacks.Error(data['responseDetails'])
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def formatData(self, data, bold=True, max=0, onetoone=False):
|
def formatData(self, data, bold=True, max=0, onetoone=False):
|
||||||
@ -187,9 +188,6 @@ class Google(callbacks.PluginRegexp):
|
|||||||
conf.supybot.plugins.Google.safesearch.validStrings:
|
conf.supybot.plugins.Google.safesearch.validStrings:
|
||||||
irc.errorInvalid('language')
|
irc.errorInvalid('language')
|
||||||
data = self.search(text, msg.args[0], dict(optlist))
|
data = self.search(text, msg.args[0], dict(optlist))
|
||||||
if data['responseStatus'] != 200:
|
|
||||||
irc.reply(_('We broke The Google!'))
|
|
||||||
return
|
|
||||||
bold = self.registryValue('bold', msg.args[0])
|
bold = self.registryValue('bold', msg.args[0])
|
||||||
max = self.registryValue('maximumResults', msg.args[0])
|
max = self.registryValue('maximumResults', msg.args[0])
|
||||||
# We don't use supybot.reply.oneToOne here, because you generally
|
# We don't use supybot.reply.oneToOne here, because you generally
|
||||||
|
Loading…
Reference in New Issue
Block a user