don't drop exception descriptions anymore
This commit is contained in:
14
urlbot.py
14
urlbot.py
@@ -100,8 +100,8 @@ def chat_write(message, prefix='/say '):
|
|||||||
|
|
||||||
fd.write(msg)
|
fd.write(msg)
|
||||||
fd.close()
|
fd.close()
|
||||||
except IOError:
|
except IOError as e:
|
||||||
logger('err', "couldn't print to fifo " + fifo_path)
|
logger('err', "couldn't print to fifo %s: %s" % (fifo_path, str(e)))
|
||||||
|
|
||||||
def ratelimit_touch(ignored=None): # FIXME: separate counters
|
def ratelimit_touch(ignored=None): # FIXME: separate counters
|
||||||
hist_ts.append(time.time())
|
hist_ts.append(time.time())
|
||||||
@@ -147,8 +147,8 @@ def extract_url(data):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
(status, title) = extract_title(url)
|
(status, title) = extract_title(url)
|
||||||
except UnicodeError:
|
except UnicodeError as e:
|
||||||
(status, title) = (4, None)
|
(status, title) = (4, str(e))
|
||||||
|
|
||||||
if 0 == status:
|
if 0 == status:
|
||||||
title = title.strip()
|
title = title.strip()
|
||||||
@@ -181,7 +181,7 @@ def extract_url(data):
|
|||||||
elif 3 == status:
|
elif 3 == status:
|
||||||
message = title
|
message = title
|
||||||
elif 4 == status:
|
elif 4 == status:
|
||||||
message = 'Bug triggered, invalid URL/domain part: %s' % url
|
message = 'Bug triggered (%s), invalid URL/domain part: %s' % (title, url)
|
||||||
logger('warn', message)
|
logger('warn', message)
|
||||||
else:
|
else:
|
||||||
message = 'some error occurred when fetching %s' % url
|
message = 'some error occurred when fetching %s' % url
|
||||||
@@ -203,8 +203,8 @@ def parse_pn(data):
|
|||||||
def parse_delete(filepath):
|
def parse_delete(filepath):
|
||||||
try:
|
try:
|
||||||
fd = open(filepath, 'r')
|
fd = open(filepath, 'r')
|
||||||
except IOError:
|
except IOError as e:
|
||||||
logger('err', 'file has vanished: ' + filepath)
|
logger('err', 'file has vanished: %s: %s' % (filepath, e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
content = fd.read(BUFSIZ) # ignore more than BUFSIZ
|
content = fd.read(BUFSIZ) # ignore more than BUFSIZ
|
||||||
|
|||||||
Reference in New Issue
Block a user