Early killing of 'parser' invocation that creates a database leaves inconsistent state with non-user-friendly error message
Assume you create a parse but realise you've done a goof in the invocation and immediately kill the parser:
root@e1281b647a0c:/usr/local/bin# ./CodeCompass_parser -w /var/lib/CodeCompass -n googletest -d "sqlite:database=/var/lib/CodeCompass/database.sqlite" -i /usr/src/googletest -i /usr/src/googletest/build/CMake
[INFO] Creating tables from file /usr/local/share/codecompass/sql/buildsourcetarget-odb.sql
^C
(My goof was that I forgot to generate the compile_commands.json, so I killed CodeCompass, went to create the JSON, came back, tried parsing for real now.)
root@e1281b647a0c:/usr/local/bin# ./CodeCompass_parser -w /var/lib/CodeCompass -n googletest -d "sqlite:database=/var/lib/CodeCompass/database.sqlite" -i /usr/src/googletest -i /usr/src/googletest/build/compile_commands.json
[INFO] Project already exists, incremental parsing in action.
terminate called after throwing an instance of 'odb::sqlite::database_exception'
what(): 1: no such table: File
Aborted (core dumped)
Currently incremental parsing checks for database existance. You propose for some database table or even schema validity check to be performed?
Just somehow catch this exception (and similar ones) and propose a user friendly error message "hey your database wasn't created successfully, do this and that to restart from scratch."
In this particular case, deleting the database file and giving -f to parser solved it.