diff --git a/C/c4Index.cc b/C/c4Index.cc index 03a38a955..cb55921f3 100644 --- a/C/c4Index.cc +++ b/C/c4Index.cc @@ -67,7 +67,7 @@ C4IndexUpdater::~C4IndexUpdater() = default; size_t C4IndexUpdater::count() const { if ( hasFinished() ) { - WarnError("C4IndexUpdater::count() called on finished updater."); + Warn("C4IndexUpdater::count() called on finished updater."); return 0; } return _update->count(); @@ -75,21 +75,24 @@ size_t C4IndexUpdater::count() const { FLValue C4IndexUpdater::valueAt(size_t i) const { if ( hasFinished() ) { - litecore::error::_throw(litecore::error::NotOpen, "C4IndexUpdater::valueAt() called on finished updater."); + Warn("C4IndexUpdater::valueAt() called on finished updater."); + return FLValue{}; } return _update->valueAt(i); } void C4IndexUpdater::setVectorAt(size_t i, const float* vector, size_t dimension) { if ( hasFinished() ) { - litecore::error::_throw(litecore::error::NotOpen, "C4IndexUpdater::setVectorAt() called on finished updater."); + Warn("C4IndexUpdater::setVectorAt() called on finished updater."); + return; } _update->setVectorAt(i, vector, dimension); } void C4IndexUpdater::skipVectorAt(size_t i) { if ( hasFinished() ) { - litecore::error::_throw(litecore::error::NotOpen, "C4IndexUpdater::SkipVectorAt() called on finished updater."); + Warn("C4IndexUpdater::SkipVectorAt() called on finished updater."); + return; } return _update->skipVectorAt(i); } diff --git a/LiteCore/tests/LazyVectorAPITest.cc b/LiteCore/tests/LazyVectorAPITest.cc index ed4502d83..e161c5aff 100644 --- a/LiteCore/tests/LazyVectorAPITest.cc +++ b/LiteCore/tests/LazyVectorAPITest.cc @@ -667,12 +667,11 @@ TEST_CASE_METHOD(LazyVectorAPITest, "IndexUpdater Call After Already Finished", // c4indexupdater_setVectorAt after finished err.code = 0; auto succ = c4indexupdater_setVectorAt(updater, 0, vectors.data(), 300, &err); - CHECK(!succ); - CHECK(err.code == kC4ErrorNotOpen); + CHECK(succ); // c4indexupdater_skipVectorAt after finished succ = c4indexupdater_skipVectorAt(updater, 0); - CHECK(!succ); + CHECK(succ); c4indexupdater_release(updater); c4index_release(index);