-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle alembic command error. #407
Conversation
@@ -96,6 +97,9 @@ 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(str(cerr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the code review feedback we should provide more user friendly error messages not just printing out the message from the exception. These error messages will be read by our users who might not be familiar with SQLAlchemy or Alembic errors.
I try to improve it in any new improvement and update our existing source too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
e6abe51
to
021e0d3
Compare
@@ -96,6 +97,10 @@ 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("Failed to update or create the database schema.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message can be a bit misleading, because in the issue description the problem is if there is a newer schema in the database and we want to connect to it with an older CodeChecker.
In that case no schema update or creation is done. Might be useful to to print out here that there is a database incompatibility between the used CodeChecker version and the database, and updating your CodeChecker release to a newer should resolve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
021e0d3
to
7fbabcc
Compare
Handle alembic command error. Fixes #384.