Changed the name of WebException to WebError.

This commit is contained in:
Jeremy Fincher 2003-12-03 04:57:30 +00:00
parent b6faf3602e
commit 7b9c0ccd86
2 changed files with 10 additions and 9 deletions

View File

@ -154,7 +154,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
else:
return 'http://sourceforge.net%s%s' % (utils.htmlToText(
m.group(1)), self._hrefOpts)
except webutils.WebException, e:
except webutils.WebError, e:
raise callbacks.Error, str(e)
def _getTrackerList(self, url):
@ -168,7 +168,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
return '%s' % utils.commaAndify(resp)
raise callbacks.Error, 'No Trackers were found. (%s)' %\
conf.replyPossibleBug
except webutils.WebException, e:
except webutils.WebError, e:
raise callbacks.Error, e.msg()
def _getTrackerInfo(self, irc, msg, url, num):
@ -181,7 +181,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
return
irc.error(msg, 'No Trackers were found. (%s)' %
conf.replyPossibleBug)
except webutils.WebException, e:
except webutils.WebError, e:
irc.error(msg, e.msg())
_bugLink = re.compile(r'"([^"]+)">Bugs')
@ -317,7 +317,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
resp.append('%s: %s' % self._bold(m.groups()))
irc.reply(msg, '%s #%s: %s' % (ircutils.bold(linktype),
ircutils.bold(num), '; '.join(resp)), prefixName = False)
except webutils.WebException, e:
except webutils.WebError, e:
self.log.warning(str(e))
sfSnarfer = privmsgs.urlSnarfer(sfSnarfer)

View File

@ -36,22 +36,23 @@ import fix
import socket
import urllib2
class WebException(Exception):
class WebError(Exception):
pass
def getUrlFd(url):
"""Gets a file-like object for a url."""
try:
fd = urllib2.urlopen(url)
return fd
except socket.error, e:
if e.args[0] == 111:
raise WebException, 'Connection refused.'
raise WebError, 'Connection refused.'
elif e.args[0] in (110, 10060):
raise WebException, 'Connection timed out.'
raise WebError, 'Connection timed out.'
else:
raise WebException, str(e)
raise WebError, str(e)
except (urllib2.HTTPError, urllib2.URLError), e:
raise WebException, str(e)
raise WebError, str(e)
def getUrl(url, size=None):
"""Gets a page. Returns a string that is the page gotten."""