Include connection errors in exception handling

This commit is contained in:
2022-08-20 12:58:47 +01:00
parent 168b2b288a
commit 72f2af1df8
15 changed files with 63 additions and 68 deletions

View File

@@ -15,7 +15,7 @@ def require_account_creation(function):
if User.query.count() == 0:
flash('Please register a user account.', 'alert')
return redirect(url_for('admin._register'))
except SQLAlchemyError as exception:
except (SQLAlchemyError, ConnectionError) as exception:
write('system.log', f'Database error when checking for existing accounts: {exception}')
return abort(500)
return function(*args, **kwargs)