[framalink] Add error handling (invalid URLs)
This commit is contained in:
parent
5141a0dc17
commit
7ce9b2bb4c
@ -23,7 +23,12 @@ def framalink_reducer(url, data):
|
|||||||
json_data = json.loads(web.getURLContent(url, "lsturl="
|
json_data = json.loads(web.getURLContent(url, "lsturl="
|
||||||
+ quote(data, "/:%@&=?"),
|
+ quote(data, "/:%@&=?"),
|
||||||
header={"Content-Type": "application/x-www-form-urlencoded"}))
|
header={"Content-Type": "application/x-www-form-urlencoded"}))
|
||||||
|
if 'short' in json_data:
|
||||||
return json_data['short']
|
return json_data['short']
|
||||||
|
elif 'msg' in json_data:
|
||||||
|
raise IRCException("Error: %s" % json_data['msg'])
|
||||||
|
else:
|
||||||
|
IRCException("An error occured while shortening %s." % data)
|
||||||
|
|
||||||
# MODULE VARIABLES ####################################################
|
# MODULE VARIABLES ####################################################
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user