From f48ae3a0f3aa24b21f88a8307384ce4bf12247e7 Mon Sep 17 00:00:00 2001 From: Rafal Walczyna Date: Fri, 12 Mar 2021 13:23:06 +0100 Subject: [PATCH] [ML][Single] Fix issues that came out after TCT tests - SingleShot.openModel should throw TypeError when no arguments provided [Verification] Tested in chrome-dev console Change-Id: I13b7946aa90f86ff4becccb9834b76d4f6bf6d22 Signed-off-by: Rafal Walczyna --- src/ml/js/ml_single.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ml/js/ml_single.js b/src/ml/js/ml_single.js index 38192a2f..f5253038 100755 --- a/src/ml/js/ml_single.js +++ b/src/ml/js/ml_single.js @@ -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); -- 2.34.1