Correct error handling when a database cannot be selected.