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 MylesBorins committed Mar 24, 2020
1 parent 11ed1e6 commit 71a2fa2
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
Original file line number Diff line number Diff line change
Expand Up @@ -1422,8 +1422,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
Original file line number Diff line number Diff line change
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 71a2fa2

Please sign in to comment.