From d341345e6c61593aa4a1bfe6e0619c249872a0d0 Mon Sep 17 00:00:00 2001 From: zhoudan03 Date: Thu, 30 May 2019 22:43:30 +0800 Subject: [PATCH 1/2] add processer function error capture --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 8251471..4473c16 100644 --- a/index.js +++ b/index.js @@ -993,6 +993,10 @@ processName = processName.slice(0, dotIndex); } + if (!processorCreators[processName] || typeof processorCreators[processName] !== 'function') { + throw new Error('[' + apiContainer.options.errorTitle + '] processName: ' + processName + ' is not a function'); + } + var processor = processorCreators[processName](description, option, apiContainer); if (typeof processor === 'function') { processors.push(processor); From 1b5199b1f1e5cf4d28f28bfb06f6436f88c886b6 Mon Sep 17 00:00:00 2001 From: zhoudan03 Date: Fri, 31 May 2019 14:17:37 +0800 Subject: [PATCH 2/2] fix: ArgEncode:JSON: just stringify object args to avoid wrapping string with quotes --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4473c16..a56a99c 100644 --- a/index.js +++ b/index.js @@ -322,7 +322,9 @@ */ function argJSONEncode(args) { each(args, function (arg, i) { - args[i] = JSON.stringify(arg); + if (typeof arg === 'object') { + args[i] = JSON.stringify(arg); + } }); return args;