diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-04-11 11:47:59 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-04-11 17:37:26 +0200 |
commit | 974b74649a3e525bc3fd809501c98716d11021bd (patch) | |
tree | 1a313ba2701b6a4336147351c38f6d820c03cb33 /ogcp/views.py | |
parent | 37bb49d7036b938c499b37b0f04ec3f9be79d316 (diff) |
Handle ogServer connection error on login
On connection error show a (toast) message warning the user. Otherwise,
users see Werkzeug debug page.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index ffd5ebf..938710d 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -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) |