From 171378e7399e7ff2651e879a8a8f4108152a6acb Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 24 Aug 2012 07:24:31 -0400 Subject: storage:http: adjust HTTPError message in get_post_url. We'll usually get this message if we fail to reach the server, but we can also get it if the server is so broken that it dies without returning a valid HTTP response. --- libbe/storage/http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libbe') diff --git a/libbe/storage/http.py b/libbe/storage/http.py index cfed7b7..20dade4 100644 --- a/libbe/storage/http.py +++ b/libbe/storage/http.py @@ -112,8 +112,8 @@ def get_post_url(url, get=True, data_dict=None, headers=[], agent=None): response = urllib2.urlopen(req) except urllib2.HTTPError, e: if hasattr(e, 'reason'): - msg = 'We failed to reach a server.\nURL: %s\nReason: %s' \ - % (url, e.reason) + msg = ('We failed to connect to the server.\nURL: {}\n' + 'Reason: {}').format(url, e.reason) elif hasattr(e, 'code'): msg = "The server couldn't fulfill the request.\nURL: %s\nError code: %s" \ % (url, e.code) -- cgit