errors: drop pronouns from ERR_WORKER_PATH message

This commit drops pronouns from the ERR_WORKER_PATH message,
and also shortens the text a bit.

PR-URL: https://github.com/nodejs/node/pull/32285
Refs: https://github.com/nodejs/node/pull/31664
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
cjihrig
2020-03-15 11:14:19 -04:00
committed by James M Snell
parent 5eb85dd972
commit c788964a75
2 changed files with 3 additions and 4 deletions

View File

@@ -1425,8 +1425,7 @@ E('ERR_WORKER_PATH', (filename) =>
'The worker script or module filename must be an absolute path or a ' +
'relative path starting with \'./\' or \'../\'.' +
(filename.startsWith('file://') ?
' If you want to pass a file:// URL, you must wrap it around `new URL`.' :
''
' Wrap file:// URLs with `new URL`.' : ''
) +
` Received "${filename}"`,
TypeError);

View File

@@ -31,12 +31,12 @@ const { Worker } = require('worker_threads');
{
assert.throws(
() => { new Worker('file:///file_url'); },
/If you want to pass a file:\/\/ URL, you must wrap it around `new URL`/
/Wrap file:\/\/ URLs with `new URL`/
);
assert.throws(
() => { new Worker('relative_no_dot'); },
// eslint-disable-next-line node-core/no-unescaped-regexp-dot
/^((?!If you want to pass a file:\/\/ URL, you must wrap it around `new URL`).)*$/s
/^((?!Wrap file:\/\/ URLs with `new URL`).)*$/s
);
}