use global GrumbleError for web exceptions

This commit is contained in:
mutantmonkey
2012-06-01 22:17:09 -07:00
parent 28cde318a8
commit 9add0985ec
16 changed files with 85 additions and 81 deletions

View File

@@ -6,6 +6,7 @@ author: mutantmonkey <mutantmonkey@mutantmonkey.in>
import urllib.request
from urllib.error import HTTPError
from tools import GrumbleError
import web
import json
@@ -30,8 +31,8 @@ def urbandict(phenny, input):
data = req.read().decode('utf-8')
data = json.loads(data)
except (HTTPError, IOError, ValueError):
phenny.say("Urban Dictionary slemped out on me. Try again in a minute.")
return
raise GrumbleError(
"Urban Dictionary slemped out on me. Try again in a minute.")
if data['result_type'] == 'no_results':
phenny.say("No results found for {0}".format(word))