From 6fb00c66762060ba0ada81ad4ef9ab08bcf72001 Mon Sep 17 00:00:00 2001 From: capGoblin Date: Mon, 9 Oct 2023 20:53:18 +0530 Subject: [PATCH 1/3] fix misleading error message when NaN passed --- src/core/friendly_errors/validate_params.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/friendly_errors/validate_params.js b/src/core/friendly_errors/validate_params.js index d040030293..b45417d2e4 100644 --- a/src/core/friendly_errors/validate_params.js +++ b/src/core/friendly_errors/validate_params.js @@ -569,7 +569,7 @@ if (typeof IS_MINIFIED !== 'undefined') { const argType = arg instanceof Array ? 'array' - : arg === null ? 'null' : arg.name || typeof arg; + : arg === null ? 'null' : isNaN(arg) ? 'NaN' : arg.name || typeof arg; translationObj = { func, From e39e34d8f1a0e1f9852a85fc737b3647dd6b4ff5 Mon Sep 17 00:00:00 2001 From: capGoblin Date: Tue, 10 Oct 2023 17:37:41 +0530 Subject: [PATCH 2/3] check NaN if arg is 'number' --- src/core/friendly_errors/validate_params.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/friendly_errors/validate_params.js b/src/core/friendly_errors/validate_params.js index b45417d2e4..b3b1171863 100644 --- a/src/core/friendly_errors/validate_params.js +++ b/src/core/friendly_errors/validate_params.js @@ -569,7 +569,7 @@ if (typeof IS_MINIFIED !== 'undefined') { const argType = arg instanceof Array ? 'array' - : arg === null ? 'null' : isNaN(arg) ? 'NaN' : arg.name || typeof arg; + : arg === null ? 'null' : typeof arg === 'number' && isNaN(arg) ? 'NaN' : arg.name || typeof arg; translationObj = { func, From d45462864624f62bb3859bb7f44a365cd5ac2d23 Mon Sep 17 00:00:00 2001 From: capGoblin Date: Tue, 10 Oct 2023 17:44:36 +0530 Subject: [PATCH 3/3] add check for undefined --- src/core/friendly_errors/validate_params.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/friendly_errors/validate_params.js b/src/core/friendly_errors/validate_params.js index b3b1171863..824926ba7a 100644 --- a/src/core/friendly_errors/validate_params.js +++ b/src/core/friendly_errors/validate_params.js @@ -569,7 +569,7 @@ if (typeof IS_MINIFIED !== 'undefined') { const argType = arg instanceof Array ? 'array' - : arg === null ? 'null' : typeof arg === 'number' && isNaN(arg) ? 'NaN' : arg.name || typeof arg; + : arg === null ? 'null' : arg === undefined ? 'undefined' : typeof arg === 'number' && isNaN(arg) ? 'NaN' : arg.name || typeof arg; translationObj = { func,