From ea4302bd46bb2de55e79ac271a601120fb72f2f5 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 15 Mar 2020 11:14:19 -0400 Subject: [PATCH] errors: drop pronouns from ERR_WORKER_PATH message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Matheus Marchini Reviewed-By: Anto Aravinth Reviewed-By: Luigi Pinca --- lib/internal/errors.js | 3 +-- test/parallel/test-worker-unsupported-path.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index dbc10e6e0739c1..94088aac108843 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -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); diff --git a/test/parallel/test-worker-unsupported-path.js b/test/parallel/test-worker-unsupported-path.js index e9cd6a32ec7cb9..1a5f53c821ee6c 100644 --- a/test/parallel/test-worker-unsupported-path.js +++ b/test/parallel/test-worker-unsupported-path.js @@ -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 ); }