Do not decode failed POST response
This change logs failed POST text response early to prevent JSONDecodeError exceptions. Change-Id: Iee88fdfb201dfca282e2098d818df7fc77d33784
This commit is contained in:
parent
c20fef1dec
commit
479df934df
|
@ -1490,6 +1490,9 @@ class Sync(object):
|
|||
self.checkResponse(r)
|
||||
self.log.debug('Received: %s' % (r.text,))
|
||||
ret = None
|
||||
if r.status_code > 400:
|
||||
raise Exception("POST to %s failed with http code %s (%s)",
|
||||
path, r.status_code, r.text)
|
||||
if r.text and len(r.text)>4:
|
||||
try:
|
||||
ret = json.loads(r.text[4:])
|
||||
|
|
Loading…
Reference in New Issue