use global GrumbleError for web exceptions
This commit is contained in:
@@ -5,6 +5,7 @@ author: mutantmonkey <mutantmonkey@mutantmonkey.in>, andreim <andreim@andreim.ne
|
||||
"""
|
||||
|
||||
from urllib.error import HTTPError
|
||||
from tools import GrumbleError
|
||||
import web
|
||||
import json
|
||||
|
||||
@@ -19,8 +20,7 @@ def linx(phenny, input):
|
||||
try:
|
||||
req = web.post("http://linx.li/vtluug", {'url': url})
|
||||
except (HTTPError, IOError):
|
||||
phenny.reply("THE INTERNET IS FUCKING BROKEN. Please try again later.")
|
||||
return
|
||||
raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.")
|
||||
|
||||
data = json.loads(req)
|
||||
if len(data) <= 0 or not data['success']:
|
||||
@@ -56,8 +56,7 @@ def lines(phenny, input):
|
||||
try:
|
||||
req = web.post("http://linx.li/vtluuglines", {'nickname': nickname, 'date': date, 'sender': input.nick})
|
||||
except (HTTPError, IOError):
|
||||
phenny.reply("THE INTERNET IS FUCKING BROKEN. Please try again later.")
|
||||
return
|
||||
raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.")
|
||||
|
||||
phenny.reply(req)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user