Add return value handling 52/262952/1
authorTae-Young Chung <ty83.chung@samsung.com>
Tue, 24 Aug 2021 02:29:59 +0000 (11:29 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Tue, 24 Aug 2021 02:30:03 +0000 (11:30 +0900)
error should be returned when exception is catched and
is handled properly.

Change-Id: If669515f2b573d3c96165647bd8eaca852d373b1
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
mv_machine_learning/mv_inference/inference/src/OutputMetadata.cpp
packaging/capi-media-vision.spec

index edd1596..84c6c6d 100755 (executable)
@@ -86,6 +86,7 @@ namespace inference
                                type = OutputMetadata::GetSupportedType(pObject, "score_type", supportedScoreTypes);
                        } catch (const std::exception& e) {
                                LOGE("Invalid %s", e.what());
+                               return MEDIA_VISION_ERROR_INVALID_OPERATION;
                        }
 
                        if (json_object_has_member(pObject, "dequantization")) {
@@ -105,18 +106,12 @@ namespace inference
 
        int OutputMetadata::ParseScore(JsonObject *root)
        {
-               LOGI("ENTER");
-
                if (!json_object_has_member(root, "score")) {
                        LOGI("No score outputmetadata");
-                       LOGI("LEAVE");
                        return MEDIA_VISION_ERROR_NONE;
                }
 
-               score.ParseScore(root);
-
-               LOGI("LEAVE");
-               return MEDIA_VISION_ERROR_NONE;
+               return score.ParseScore(root);
        }
 
        BoxInfo::BoxInfo() :
@@ -167,6 +162,7 @@ namespace inference
                                decodingType = OutputMetadata::GetSupportedType(pObject, "decoding_type", supportedBoxDecodingTypes);
                        } catch (const std::exception& e) {
                                LOGE("Invalid %s", e.what());
+                               return MEDIA_VISION_ERROR_INVALID_OPERATION;
                        }
 
                        array = json_object_get_array_member(pObject, "box_order");
@@ -205,18 +201,12 @@ namespace inference
 
        int OutputMetadata::ParseBox(JsonObject *root)
        {
-               LOGI("ENTER");
-
                if (!json_object_has_member(root, "box")) {
                        LOGE("No box outputmetadata");
-                       LOGI("LEAVE");
                        return MEDIA_VISION_ERROR_NONE;
                }
 
-               box.ParseBox(root);
-
-               LOGI("LEAVE");
-               return MEDIA_VISION_ERROR_NONE;
+               return box.ParseBox(root);
        }
 
        int Label::ParseLabel(JsonObject *root)
@@ -558,6 +548,7 @@ namespace inference
                        this->nmsParam.mode = OutputMetadata::GetSupportedType(object, "mode", this->nmsParam.supportedBoxNmsTypes);
                } catch (const std::exception& e) {
                        LOGE("Invalid %s", e.what());
+                       return MEDIA_VISION_ERROR_INVALID_OPERATION;
                }
 
                this->nmsParam.iouThreshold = static_cast<float>(json_object_get_double_member(object,"iou_threshold"));
index be18794..1e2ea4f 100644 (file)
@@ -1,7 +1,7 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
 Version:     0.8.10
-Release:     0
+Release:     1
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause
 Source0:     %{name}-%{version}.tar.gz