Properly include database query error messages