mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +01:00
Added better error reporting.
This commit is contained in:
parent
c8b09bd44d
commit
ce67b6ef5a
@ -302,6 +302,8 @@ class Http(callbacks.Privmsg):
|
|||||||
fd = urllib2.urlopen(url)
|
fd = urllib2.urlopen(url)
|
||||||
html = fd.read()
|
html = fd.read()
|
||||||
fd.close()
|
fd.close()
|
||||||
|
if 'was not found' in html:
|
||||||
|
irc.error(msg, 'No such location could be found.')
|
||||||
headData = self._cityregex.search(html)
|
headData = self._cityregex.search(html)
|
||||||
if headData:
|
if headData:
|
||||||
(city, state, country) = headData.groups()
|
(city, state, country) = headData.groups()
|
||||||
@ -319,11 +321,11 @@ class Http(callbacks.Privmsg):
|
|||||||
irc.reply(msg, s)
|
irc.reply(msg, s)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'The format of the page was odd.')
|
irc.error(msg, 'The format of the page was odd.')
|
||||||
|
|
||||||
except urllib2.URLError:
|
except urllib2.URLError:
|
||||||
irc.error(msg, 'I couldn\'t open the search page.')
|
irc.error(msg, 'I couldn\'t open the search page.')
|
||||||
except:
|
except Exception, e:
|
||||||
irc.error(msg, 'The format of the page was odd.')
|
debug.recoverableError()
|
||||||
|
irc.error(msg, debug.exnToString(e))
|
||||||
|
|
||||||
_geekquotere = re.compile('<p class="qt">(.*?)</p>')
|
_geekquotere = re.compile('<p class="qt">(.*?)</p>')
|
||||||
def geekquote(self, irc, msg, args):
|
def geekquote(self, irc, msg, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user