better err msg on bad status line

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1318 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2004-05-26 23:02:47 +00:00
parent abccff16ea
commit e9341590d4

View file

@ -18,7 +18,7 @@
import sys, re, urlparse, urllib2, time, traceback, socket, select, i18n
from urllib import splituser, splitport, unquote
from linkcheck import DNS, LinkCheckerError, getLinkPat
from linkcheck import DNS, LinkCheckerError, getLinkPat, httplib2
from linkcheck.parser import htmlsax
DNS.DiscoverNameServers()
@ -345,6 +345,9 @@ class UrlData (object):
# make nicer error msg for unknown hosts
if isinstance(evalue, socket.error) and evalue[0]==-2:
evalue = i18n._('Hostname not found')
# make nicer error msg for bad status line
if isinstance(evalue, httplib2.BadStatusLine):
evalue = i18n._('Bad HTTP response %r')%str(evalue)
self.setError(str(evalue))
# check content