New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: migrate errors to internal/errors #17716

Closed
wants to merge 7 commits into
base: master
from

Conversation

@kysnm
Contributor

kysnm commented Dec 17, 2017

Refs: #17709

cc @jasnell @joyeecheung

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc, errors, repl

@kysnm

This comment has been minimized.

Contributor

kysnm commented Dec 17, 2017

It is failed at test/async-hooks/test-callback-error.js on my local environment, but master branch also fails.

@Trott Trott added the semver-major label Dec 17, 2017

@Trott

This comment has been minimized.

Member

Trott commented Dec 17, 2017

@kysnm Sounds like you may be experiencing #15985 on your local machine. If you do any troubleshooting and find information that may be useful, please put it in that issue! (And if you find a fix for the problem, please submit a pull request!)

Otherwise, yes, that is most likely unrelated to the change here.

CI: https://ci.nodejs.org/job/node-test-pull-request/12157/

@Trott

This comment has been minimized.

Member

Trott commented Dec 17, 2017

Pinging @nodejs/tsc since this will need two TSC approvals.

lib/repl.js Outdated
@@ -315,7 +315,8 @@ function REPLServer(prompt,
} catch (e) {
err = e;
if (err && err.message === 'Script execution interrupted.') {
if (err && err.message ===
errors.message('ERR_SCRIPT_EXECUTION_INTERRUPTED')) {

This comment has been minimized.

@joyeecheung

joyeecheung Dec 17, 2017

Member

I think you can check if err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED' here instead (which is kinda the point of this PR, the code instead of the message should be used to match a type of error)

@@ -341,6 +341,13 @@ assert.strictEqual(
);
}
// Test ERR_SCRIPT_EXECUTION_INTERRUPTED
assert.strictEqual(

This comment has been minimized.

@joyeecheung

joyeecheung Dec 17, 2017

Member

This test does not look particularly useful since the error message formatter does not take any parameters for this error.

@@ -160,7 +161,8 @@ async function ctrlCTest() {
{ ctrl: true, name: 'c' }
]), [
'await timeout(100000)\r',
'Thrown: Error: Script execution interrupted.',
'Thrown: Error [ERR_SCRIPT_EXECUTION_INTERRUPTED]: ' +
errors.message('ERR_SCRIPT_EXECUTION_INTERRUPTED'),

This comment has been minimized.

@joyeecheung

joyeecheung Dec 17, 2017

Member

Since we are actually testing the error message, we don't really need to generate it with errors.message, can you change this to match the actual error message instead?

@joyeecheung

This comment has been minimized.

Member

joyeecheung commented Dec 17, 2017

There are several tests that do incomplete matches against this error message, those should be updated as well, not necessarily in this PR though.

<a id="ERR_SCRIPT_EXECUTION_INTERRUPTED"></a>
### ERR_SCRIPT_EXECUTION_INTERRUPTED
A script execution interrupted.

This comment has been minimized.

@joyeecheung

joyeecheung Dec 17, 2017

Member

Can you elaborate a bit more on this? For example:

Script execution was interrupted by `SIGINT` (Ctrl+C).
@kysnm

This comment has been minimized.

Contributor

kysnm commented Dec 18, 2017

@joyeecheung
cc @jasnell

I have fixed as you pointed out. Please review.

@Trott

This comment has been minimized.

Member

Trott commented Dec 18, 2017

Nit, just a suggestion, not a blocking objection: I think we should probably leave it at SIGINT and not add Cntl+C since there are other ways to send SIGINT that don't involve control+c.

@kysnm

This comment has been minimized.

Contributor

kysnm commented Dec 18, 2017

@Trott
Thanks for your review. I almost agree with you. But, It is included Ctrl+C in a few docs. How do you think?
(I know. deps is almost irrelevant ...)

deps/v8/tools/testrunner/network/network_execution.py:        # Use a timeout so that signals (Ctrl+C) will be processed.
doc/api/vm.md:    `SIGINT` (Ctrl+C) is received. Existing handlers for the
<a id="ERR_SCRIPT_EXECUTION_INTERRUPTED"></a>
### ERR_SCRIPT_EXECUTION_INTERRUPTED
Script execution was interrupted by `SIGINT` (Ctrl+C).

This comment has been minimized.

@joyeecheung

joyeecheung Dec 19, 2017

Member

I kind of agree with @Trott that this is not exactly accurate. Maybe here we should say (for example, when Ctrl+C was pressed) instead

@@ -440,6 +440,8 @@ E('ERR_OUTOFMEMORY', 'Out of memory');
E('ERR_OUT_OF_RANGE', 'The "%s" argument is out of range');
E('ERR_PARSE_HISTORY_DATA', 'Could not parse history data in %s');
E('ERR_REQUIRE_ESM', 'Must use import to load ES Module: %s');
E('ERR_SCRIPT_EXECUTION_INTERRUPTED',
'Script execution was interrupted by `SIGINT` (Ctrl+C).');

This comment has been minimized.

@joyeecheung

joyeecheung Dec 19, 2017

Member

We probably don't need the part in the parentheses in the error message. The details should be in the docs.

@kysnm

This comment has been minimized.

Contributor

kysnm commented Dec 19, 2017

@joyeecheung joyeecheung referenced this pull request Dec 20, 2017

Closed

Tracking issue: Migrate errors to internal/errors.js #17709

6 of 6 tasks complete
@joyeecheung

This comment has been minimized.

@mcollina

LGTM

@joyeecheung

This comment has been minimized.

Member

joyeecheung commented Dec 22, 2017

@maclover7

This comment has been minimized.

Member

maclover7 commented Dec 22, 2017

Landing...

@maclover7 maclover7 self-assigned this Dec 22, 2017

@maclover7

This comment has been minimized.

Member

maclover7 commented Dec 22, 2017

Thank you for your contribution, landed in ab5a2ab.
❤️ 💚 💙 💛 💜

@maclover7 maclover7 closed this Dec 22, 2017

maclover7 added a commit to maclover7/node that referenced this pull request Dec 22, 2017

repl: migrate errors to internal/errors
PR-URL: nodejs#17716
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

msoechting added a commit to hpicgs/node that referenced this pull request Feb 5, 2018

repl: migrate errors to internal/errors
PR-URL: nodejs#17716
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

msoechting added a commit to hpicgs/node that referenced this pull request Feb 7, 2018

repl: migrate errors to internal/errors
PR-URL: nodejs#17716
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment