app: fix error

This commit is contained in:
Swapnil 2024-01-30 21:45:08 +05:30
parent f34b85d79f
commit 20423379a2
Signed by: swapnil
GPG Key ID: 58029C48BB100574

View File

@ -182,7 +182,12 @@ def set_session_token_id(token_id):
def raise_for_status(response):
if response.status_code not in range(200, 300):
raise Exception(f'HTTPError: {response.status_code} \n Message: {response.json()}')
msg = None
try:
msg = response.json().get('error', '')
except:
pass
raise Exception(f'HTTPError: {response.status_code} \n Message: {msg}')
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True, port=5000)