Handle ogServer connection error on login

On connection error show a (toast) message warning the user. Otherwise,
users see Werkzeug debug page.
multi-ogserver
Javier Sánchez Parra 2022-04-11 11:47:59 +02:00
parent 37bb49d703
commit 974b74649a
1 changed files with 7 additions and 1 deletions

View File

@ -232,7 +232,13 @@ def index():
if not current_user.is_authenticated:
return redirect(url_for('login'))
clients = get_clients()
try:
clients = get_clients()
except requests.exceptions.RequestException as err:
flash(_('ogServer connection failed: {}.').format(err),
category='error')
logout_user()
return redirect(url_for('index'))
images_response = g.server.get('/images')
images = images_response.json()['images']
images.sort(key=image_modified_date_from_str, reverse=True)