Commit 92dde879 authored by ericw's avatar ericw
Browse files

Print error message from urllib2.HTTPError

parent 1a700fe0
......@@ -10,7 +10,7 @@ Tests the local FroNtier squid
# 3) file $CMS_PATH/SITECONF/local/JobConfig/site-local-config.xml
# contains the location of the local FroNtier squid server
#
__revision__ = "$Id: test_squid.py,v 1.8 2007/03/01 19:18:14 ericw Exp $"
__revision__ = "$Id: test_squid.py,v 1.9 2007/03/02 16:53:51 ericw Exp $"
import os
import sys
import urllib2
......@@ -143,17 +143,30 @@ t1 = time.time()
#
try:
result = urllib2.urlopen(request).read()
except urllib2.HTTPError, e:
message1 = e.msg
if site != "CERN":
print "test_squid.py: Error. squid " + squid + " is down, "
print " unreachable or will not reply."
print " urllib2.HTTPError: " + message1
sys.exit(same_error)
else:
print "test_squid.py: Error. FroNtier server " + frontierUrl
print " is down, unreachable or will not reply."
print " urllib2.HTTPError: " + message1
sys.exit(same_error)
except urllib2.URLError, e:
rc, message = e.reason
print "urllib2.URLError"
message2 = e.reason[1]
if site != "CERN":
print "test_squid.py: Error. squid " + squid + " is down, "
print " unreachable or will not reply."
print " " + message
print " urllib2.URLError: " + message2
sys.exit(same_error)
else:
print "test_squid.py: Error. FroNtier server " + frontierUrl
print " is down, unreachable or will not reply."
print " " + message
print " urllib2.URLError: " + message2
sys.exit(same_error)
except:
print "test_squid.py: Error."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment