[ML][Single] Fix issues that came out after TCT tests 59/255159/1
authorRafal Walczyna <r.walczyna@samsung.com>
Fri, 12 Mar 2021 12:23:06 +0000 (13:23 +0100)
committerRafal Walczyna <r.walczyna@samsung.com>
Fri, 12 Mar 2021 14:12:07 +0000 (15:12 +0100)
- SingleShot.openModel should throw TypeError when no arguments provided

[Verification] Tested in chrome-dev console

Change-Id: I13b7946aa90f86ff4becccb9834b76d4f6bf6d22
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
src/ml/js/ml_single.js

index 38192a2..f525303 100755 (executable)
@@ -64,6 +64,14 @@ MachineLearningSingle.prototype.openModel = function() {
             optional: true
         }
     ]);
+
+    if (!args.has.modelPath) {
+        throw new WebAPIException(
+            WebAPIException.TYPE_MISMATCH_ERR,
+            'Invalid parameter: modelPath is undefined'
+        );
+    }
+
     try {
         // get normalized URI of a file
         args.modelPath = tizen.filesystem.toURI(args.modelPath);