From 7fbabcc82bbe188ac349cdd1236869c2bd3f9fb8 Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Sun, 16 Oct 2016 15:53:15 +0200 Subject: [PATCH] Handle alembic command error. --- codechecker_lib/database_handler.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codechecker_lib/database_handler.py b/codechecker_lib/database_handler.py index 3eb4f111e8..a842a737a6 100644 --- a/codechecker_lib/database_handler.py +++ b/codechecker_lib/database_handler.py @@ -15,6 +15,7 @@ from abc import ABCMeta, abstractmethod import sqlalchemy +from alembic.util import CommandError from alembic import command, config from sqlalchemy import event from sqlalchemy.engine import Engine @@ -96,6 +97,11 @@ def _create_or_update_schema(self, use_migration=True): except sqlalchemy.exc.SQLAlchemyError as alch_err: LOG.error(str(alch_err)) sys.exit(1) + except CommandError as cerr: + LOG.error("Database schema and CodeChecker is incompatible." + "Please update CodeChecker.") + LOG.debug(str(cerr)) + sys.exit(1) @abstractmethod def start(self, db_version_info, wait_for_start=True, init=False):