mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-28 10:46:15 +01:00
improve error handling, by printing the <summary> given by the API for HTTP status code 400 (bad request)
This commit is contained in:
parent
ac55bcaa5a
commit
bbe533087e
@ -80,13 +80,19 @@ def run(prg):
|
||||
print >>sys.stderr, e.hdrs
|
||||
print >>sys.stderr, e.read()
|
||||
|
||||
if e.code == 400:
|
||||
msg = e.read()
|
||||
msg = msg.split('<summary>')[1]
|
||||
msg = msg.split('</summary>')[0]
|
||||
print >>sys.stderr, msg
|
||||
|
||||
# For 404s, check out _which_ part was not found
|
||||
#
|
||||
# It is very ugly, but may be Good for pragmatic reasons
|
||||
#
|
||||
# FIXME this can be obsoleted when the api returns a more specific error code
|
||||
# like "project not found" right away
|
||||
if e.code == 404:
|
||||
elif e.code == 404:
|
||||
import urlparse
|
||||
scheme, netloc, path = urlparse.urlsplit(e.url)[0:3]
|
||||
parts = path.split('/')
|
||||
|
Loading…
Reference in New Issue
Block a user