feat(db) fix get plugins if no database exists

This commit is contained in:
Tim Gröger 2023-02-17 15:30:05 +01:00
parent 8a656c3c89
commit 7796f45097
1 changed files with 2 additions and 2 deletions

View File

@ -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