Avoid exception accessing unknown project database

User validation was throwing an exception when accessing
an unknown project's database.
The actual exception is OperationalError and it should
not be raised in this case.
This fix catches this specific error, logs it, marks all
cohort users with that project as invalid (invalid project),
and continues the execution.
See also the test added.

Bug: 72582
Change-Id: Ic0f08c34252a43d925aace98cee1b54ec8432bb9