summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp b/mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp
index 598aaae0..9ac83516 100644
--- a/mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp
+++ b/mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp
@@ -98,11 +98,16 @@ int mv_face_recognition_prepare_open(mv_face_recognition_h handle)
return MEDIA_VISION_ERROR_INVALID_PARAMETER;
}
- Context *context = static_cast<Context *>(handle);
- auto task = static_cast<FaceRecognitionTask *>(context->__tasks["face_recognition"]);
+ try {
+ Context *context = static_cast<Context *>(handle);
+ auto task = static_cast<FaceRecognitionTask *>(context->__tasks["face_recognition"]);
- task->configure();
- task->prepare();
+ task->configure();
+ task->prepare();
+ } catch (const BaseException& e) {
+ LOGE("%s", e.what());
+ return e.getError();
+ }
LOGD("LEAVE");
@@ -129,7 +134,7 @@ int mv_face_recognition_register_open(mv_face_recognition_h handle, mv_source_h
task->setInput(input);
task->perform();
} catch (const BaseException& e) {
- LOGE("Fail to register new face.");
+ LOGE("%s", e.what());
return e.getError();
}
@@ -158,7 +163,7 @@ int mv_face_recognition_unregister_open(mv_face_recognition_h handle, const char
task->setInput(input);
task->perform();
} catch (const BaseException& e) {
- LOGE("Fail to unregister a given label.");
+ LOGE("%s", e.what());
return e.getError();
}
@@ -186,7 +191,7 @@ int mv_face_recognition_inference_open(mv_face_recognition_h handle, mv_source_h
task->setInput(input);
task->perform();
} catch (const BaseException& e) {
- LOGE("Fail to recognize a face.");
+ LOGE("%s", e.what());
return e.getError();
}
@@ -210,7 +215,7 @@ int mv_face_recognition_get_label_open(mv_face_recognition_h handle, const char
*out_label = task->getOutput().label.c_str();
} catch (const BaseException& e) {
- LOGE("Fail to get label.");
+ LOGE("%s", e.what());
return e.getError();
}