wikipedia: catch all filthy exceptions
This commit is contained in:
parent
5ca4a25b1f
commit
b7b6ca71be
|
@ -40,7 +40,7 @@ class WikipediaPlugin(Plugin):
|
||||||
try:
|
try:
|
||||||
summary = wikipedia.summary(wikipedia.random(), sentences=1)
|
summary = wikipedia.summary(wikipedia.random(), sentences=1)
|
||||||
break
|
break
|
||||||
except wikipedia.exceptions.WikipediaException:
|
except: # The wikipedia package can raise a lot of different stuff.
|
||||||
pass
|
pass
|
||||||
retries -= 1
|
retries -= 1
|
||||||
if summary:
|
if summary:
|
||||||
|
@ -59,7 +59,7 @@ class WikipediaPlugin(Plugin):
|
||||||
except wikipedia.exceptions.PageError:
|
except wikipedia.exceptions.PageError:
|
||||||
summary = self.config["empty_response"]
|
summary = self.config["empty_response"]
|
||||||
break
|
break
|
||||||
except wikipedia.exceptions.WikipediaException:
|
except:
|
||||||
summary = self.bot.config["error_message"]
|
summary = self.bot.config["error_message"]
|
||||||
# Keep trying after a slight delay.
|
# Keep trying after a slight delay.
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
Loading…
Reference in a new issue