mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 01:37:17 +00:00
fix: [Splash_Manager errors] catch invalid response
This commit is contained in:
parent
a17ab90511
commit
2abe5217aa
1 changed files with 11 additions and 6 deletions
|
@ -1055,12 +1055,17 @@ def ping_splash_manager():
|
||||||
update_splash_manager_connection_status(True)
|
update_splash_manager_connection_status(True)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
res = req.json()
|
res = req.json()
|
||||||
if 'reason' in res:
|
if 'reason' in res:
|
||||||
req_error = {'status_code': req.status_code, 'error': res['reason']}
|
req_error = {'status_code': req.status_code, 'error': res['reason']}
|
||||||
else:
|
else:
|
||||||
print(req.json())
|
print(req.json())
|
||||||
req_error = {'status_code': req.status_code, 'error': json.dumps(req.json())}
|
req_error = {'status_code': req.status_code, 'error': json.dumps(req.json())}
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
print(req.status_code)
|
||||||
|
print(req.headers)
|
||||||
|
req_error = {'status_code': req.status_code, 'error': 'Invalid response'}
|
||||||
update_splash_manager_connection_status(False, req_error=req_error)
|
update_splash_manager_connection_status(False, req_error=req_error)
|
||||||
return False
|
return False
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
|
|
Loading…
Reference in a new issue