Skip to content

Commit 272ff3b

Browse files
committed
fix DynamicVamanaIndex::check_storage_kind() implementation
1 parent 3030814 commit 272ff3b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

bindings/cpp/src/dynamic_vamana_index.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,18 @@ using DynamicVamanaIndexLeanVecImplManager =
126126

127127
// DynamicVamanaIndex interface implementation
128128
Status DynamicVamanaIndex::check_storage_kind(StorageKind storage_kind) noexcept {
129-
return runtime_error_wrapper([&] {
130-
return storage::is_supported_storage_kind(storage_kind)
131-
? Status_Ok
132-
: Status(
133-
ErrorCode::INVALID_ARGUMENT,
134-
"The specified storage kind is not compatible with the "
135-
"DynamicVamanaIndex"
136-
);
129+
bool supported = false;
130+
auto status = runtime_error_wrapper([&] {
131+
supported = storage::is_supported_storage_kind(storage_kind);
137132
});
133+
if (status != Status_Ok) {
134+
return status;
135+
}
136+
return supported ? Status_Ok
137+
: Status(
138+
ErrorCode::NOT_IMPLEMENTED,
139+
"Requested storage kind is not supported by CPU"
140+
);
138141
}
139142

140143
Status DynamicVamanaIndex::build(

0 commit comments

Comments
 (0)