From 37149808c9ca9baf56abf764aa07c46940d4c30b Mon Sep 17 00:00:00 2001 From: ozanarmagan Date: Tue, 21 Nov 2023 22:04:42 +0300 Subject: [PATCH] Store error mesage as constant string --- src/index.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.cpp b/src/index.cpp index 6fc3da7b..011f6ed5 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -7035,10 +7035,11 @@ void Index::batch_embed_fields(std::vector& records, if(is_image_embedding) { auto embedder_op = embedder_manager.get_image_embedder(field.embed[fields::model_config]); if(!embedder_op.ok()) { + const std::string& error_msg = "Could not find image embedder for model: " + field.embed[fields::model_config][fields::model_name].get(); for(auto& record : records) { - record->index_failure(400, "Could not find image embedder for model: " + field.embed[fields::model_config][fields::model_name].get()); + record->index_failure(400, error_msg); } - LOG(ERROR) << "Error: " << "Could not find image embedder for model: " + field.embed[fields::model_config][fields::model_name].get(); + LOG(ERROR) << "Error: " << error_msg; return; } embeddings = embedder_op.get()->batch_embed(values);