Skip to content

Commit 3b45c05

Browse files
VoltrexKeyvaBethGriggs
authored andcommitted
process: use validateString validator
Use the `validateString()` validator where applicable. PR-URL: #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>
1 parent 55adcb7 commit 3b45c05

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/internal/process/report.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
const {
3-
ERR_INVALID_ARG_TYPE,
43
ERR_SYNTHETIC
54
} = require('internal/errors').codes;
65
const {
@@ -18,9 +17,11 @@ const report = {
1817
if (typeof file === 'object' && file !== null) {
1918
err = file;
2019
file = undefined;
21-
} else if (file !== undefined && typeof file !== 'string') {
22-
throw new ERR_INVALID_ARG_TYPE('file', 'String', file);
23-
} else if (err === undefined) {
20+
} else if (file !== undefined) {
21+
validateString(file, 'file');
22+
}
23+
24+
if (err === undefined) {
2425
err = new ERR_SYNTHETIC();
2526
} else {
2627
validateObject(err, 'err');

0 commit comments

Comments
 (0)