From 13624aba4257fde6bb1f59da2a0dd7b3aab9843f Mon Sep 17 00:00:00 2001 From: stevezyyang Date: Thu, 4 Jul 2019 13:04:48 +0800 Subject: [PATCH] fix(utils): just use console.error when miss required params --- package.json | 2 +- src/utils/params.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d3904e3..3a132fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tua-api", - "version": "1.3.1", + "version": "1.3.2", "description": "🏗 A common tool helps converting configs to api functions", "main": "dist/TuaApi.cjs.js", "module": "dist/TuaApi.esm.js", diff --git a/src/utils/params.js b/src/utils/params.js index dd37179..3fefdc2 100644 --- a/src/utils/params.js +++ b/src/utils/params.js @@ -62,7 +62,12 @@ const getDefaultParamObj = ({ args[key] == null if (isRequiredValUndefined) { - throw Error(ERROR_STRINGS.requiredParamFn(apiName, key)) + logger.error(ERROR_STRINGS.requiredParamFn(apiName, key)) + + /* istanbul ignore next */ + if (process.env.NODE_ENV === 'test') { + throw TypeError(ERROR_STRINGS.requiredParamFn(apiName, key)) + } } return { [key]: val }