diff options
author | W. Trevor King <wking@tremily.us> | 2012-10-28 20:08:30 -0400 |
---|---|---|
committer | W. Trevor King <wking@tremily.us> | 2012-10-28 20:08:30 -0400 |
commit | 71e53cb9db2755940340ccd73f542e48ae27a064 (patch) | |
tree | 898b9ce7d7e8665ca56eb31b831efe3ba1cc27bb /libbe | |
parent | 8f1515c8130bff5de7335f648d6bbffc0a4615e5 (diff) | |
download | bugseverywhere-71e53cb9db2755940340ccd73f542e48ae27a064.tar.gz |
util:http: special handling for HTTP_USER_ERROR in get_post_url().
Diffstat (limited to 'libbe')
-rw-r--r-- | libbe/util/http.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libbe/util/http.py b/libbe/util/http.py index b307092..a1ab06a 100644 --- a/libbe/util/http.py +++ b/libbe/util/http.py @@ -105,10 +105,11 @@ def get_post_url(url, get=True, data=None, data_dict=None, headers=[], try: response = urllib2.urlopen(req) except urllib2.HTTPError, e: - lines = [ - 'We failed to connect to the server (HTTPError).', - 'URL: {}'.format(url), - ] + if e.code == HTTP_USER_ERROR: + lines = ['The server reported a user error (HTTPError)'] + else: + lines = ['The server reported an error (HTTPError)'] + lines.append('URL: {}'.format(url)) if hasattr(e, 'reason'): lines.append('Reason: {}'.format(e.reason)) lines.append('Error code: {}'.format(e.code)) |