Skip to content

Commit

Permalink
errors: drop pronouns from ERR_WORKER_PATH message
Browse files Browse the repository at this point in the history
This commit drops pronouns from the ERR_WORKER_PATH message,
and also shortens the text a bit.

PR-URL: #32285
Refs: #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>
  • Loading branch information
cjihrig authored and targos committed Apr 28, 2020
1 parent 4ec25b4 commit ea4302b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/internal/errors.js
Expand Up @@ -1415,8 +1415,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);
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-worker-unsupported-path.js
Expand Up @@ -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
);
}

Expand Down

0 comments on commit ea4302b

Please sign in to comment.