Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>2022-01-22 02:46:16 +0300
committerGitHub <noreply@github.com>2022-01-22 02:46:16 +0300
commit82756836b25cd08bc942a5398be7caefee95229f (patch)
treed181024c65b79f2cd9b72dd64b130659671f3e00 /lib
parentd0ea81c98446dc3229258f39c534208fadc5dd49 (diff)
process: use validateString validator
Use the `validateString()` validator where applicable. PR-URL: https://github.com/nodejs/node/pull/41595 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/process/report.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/internal/process/report.js b/lib/internal/process/report.js
index f34b71abe57..b07fd0c1ff6 100644
--- a/lib/internal/process/report.js
+++ b/lib/internal/process/report.js
@@ -1,6 +1,5 @@
'use strict';
const {
- ERR_INVALID_ARG_TYPE,
ERR_SYNTHETIC
} = require('internal/errors').codes;
const {
@@ -18,9 +17,11 @@ const report = {
if (typeof file === 'object' && file !== null) {
err = file;
file = undefined;
- } else if (file !== undefined && typeof file !== 'string') {
- throw new ERR_INVALID_ARG_TYPE('file', 'String', file);
- } else if (err === undefined) {
+ } else if (file !== undefined) {
+ validateString(file, 'file');
+ }
+
+ if (err === undefined) {
err = new ERR_SYNTHETIC();
} else {
validateObject(err, 'err');