Skip to content

Commit

Permalink
process: use validateString validator
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
VoltrexKeyva authored and danielleadams committed Mar 14, 2022
1 parent 7ee3cdf commit 77cb604
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/internal/process/report.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const {
ERR_INVALID_ARG_TYPE,
ERR_SYNTHETIC
} = require('internal/errors').codes;
const {
Expand All @@ -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');
Expand Down

0 comments on commit 77cb604

Please sign in to comment.