From 7796f45097546cfd9599aba828b5df099a1bc7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Fri, 17 Feb 2023 15:30:05 +0100 Subject: [PATCH] feat(db) fix get plugins if no database exists --- flaschengeist/controller/pluginController.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flaschengeist/controller/pluginController.py b/flaschengeist/controller/pluginController.py index 4a84d3c..5143482 100644 --- a/flaschengeist/controller/pluginController.py +++ b/flaschengeist/controller/pluginController.py @@ -6,7 +6,7 @@ Used by plugins for setting and notification functionality. from typing import Union from flask import current_app from werkzeug.exceptions import NotFound, BadRequest -from sqlalchemy.exc import OperationalError +from sqlalchemy.exc import OperationalError, ProgrammingError from flask_migrate import upgrade as database_upgrade from importlib.metadata import entry_points @@ -43,7 +43,7 @@ def get_enabled_plugins() -> list[Plugin]: """Get all installed and enabled plugins""" try: enabled_plugins = Plugin.query.filter(Plugin.enabled == True).all() - except OperationalError as e: + except (OperationalError, ProgrammingError) as e: logger.error("Could not connect to database or database not initialized! No plugins enabled!") logger.debug("Can not query enabled plugins", exc_info=True) # Fake load required plugins so the database can at least be installed