summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInki Dae <inki.dae@samsung.com>2022-07-20 16:22:54 +0900
committerInki Dae <inki.dae@samsung.com>2022-09-02 17:09:25 +0900
commitcb80c9ef943361e067068970735517c26aedb359 (patch)
tree6e3d830d3e41d982a030b8992a57f7b66f82b1e0
parentc58b8740f1860924d59e1ca951a69b54acdbc5b0 (diff)
downloadmediavision-cb80c9ef943361e067068970735517c26aedb359.tar.gz
mediavision-cb80c9ef943361e067068970735517c26aedb359.tar.bz2
mediavision-cb80c9ef943361e067068970735517c26aedb359.zip
mv_machine_learning: add try-catch statement
[Issue type] bug fix Added try-catch statement to mv_face_recognition_prepare_open function, which was missed, printed out the error messages correctly. Change-Id: I0753cda2b894c10033141f69a0a3e1d60eb303e7 Signed-off-by: Inki Dae <inki.dae@samsung.com>
-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();
}