Skip to content
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

errors,repl: migrate to use internal/errors.js #13299

Closed
wants to merge 1 commit into from

Conversation

@sreepurnajasti
Copy link
Contributor

@sreepurnajasti sreepurnajasti commented May 30, 2017

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

lib/internal/repl.js
lib/internal/errors.js

ref: #11273

E('ERR_IPC_CHANNEL_CLOSED', 'channel closed');
E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected');
E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe');
E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks');
E('ERR_MISSING_ARGS', missingArgs);
E('ERR_PARSE_HISTORY_DATA',
(oldHistoryPath) => `Could not parse history data in ${oldHistoryPath}`);

This comment has been minimized.

@jasnell

jasnell May 30, 2017
Member

Just a nit, but it's a bit odd to have one of the new codes use %s while the other uses a template string.

This comment has been minimized.

@sreepurnajasti

sreepurnajasti May 31, 2017
Author Contributor

@jasnell I have used template string. So, do you want me to convert it to %s?

This comment has been minimized.

@jasnell

jasnell May 31, 2017
Member

I would switch the ERR_INVALID_REPL_HISTORY one to use a template string

This comment has been minimized.

@sreepurnajasti

sreepurnajasti Jun 1, 2017
Author Contributor

@jasnell Done.

lib/internal/repl.js Outdated
@@ -153,13 +154,14 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
if (oldReplJSONHistory) repl.history = JSON.parse(oldReplJSONHistory);

if (!Array.isArray(repl.history)) {
throw new Error('Expected array, got ' + typeof repl.history);
throw new errors.Error('ERR_INVALID_REPL_HISTORY',

This comment has been minimized.

@jasnell

jasnell May 30, 2017
Member

This should likely be a TypeError. Since this is already a semver-major change, may as well fix the type

This comment has been minimized.

@sreepurnajasti

sreepurnajasti May 31, 2017
Author Contributor

@jasnell I too thought on those lines. But to be consistent with previous code, I did in that manner. Now, it is fixed. Thanks.

@sreepurnajasti sreepurnajasti force-pushed the sreepurnajasti:repl branch May 31, 2017
lib/internal/repl.js Outdated
@@ -153,13 +154,14 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
if (oldReplJSONHistory) repl.history = JSON.parse(oldReplJSONHistory);

if (!Array.isArray(repl.history)) {
throw new Error('Expected array, got ' + typeof repl.history);
throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
typeof repl.history, 'Array');

This comment has been minimized.

@jasnell

jasnell May 31, 2017
Member

be sure to line up the arguments appropriate and run make lint

This comment has been minimized.

@sreepurnajasti

sreepurnajasti Jun 1, 2017
Author Contributor

@jasnell Unfortunately, it is not captured in lint test. Now, it's Done.

@sreepurnajasti sreepurnajasti force-pushed the sreepurnajasti:repl branch to 3e61b91 Jun 1, 2017
Copy link
Member

@mhdawson mhdawson left a comment

LGTM

@jasnell
jasnell approved these changes Jun 1, 2017
jasnell added a commit that referenced this pull request Jun 2, 2017
PR-URL: #13299
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

@jasnell jasnell commented Jun 2, 2017

Landed in 2822796

@jasnell jasnell closed this Jun 2, 2017
@joyeecheung joyeecheung mentioned this pull request Jun 2, 2017
4 of 4 tasks complete
@tniessen
Copy link
Member

@tniessen tniessen commented Jun 18, 2017

Too late, but doesn't LGTM. ERR_INVALID_REPL_HISTORY doesn't appear to be used at all. Please review #13733.

@tniessen tniessen mentioned this pull request Jun 18, 2017
3 of 3 tasks complete
@refack refack added this to Done in Error Codes Aug 20, 2017
@sreepurnajasti sreepurnajasti deleted the sreepurnajasti:repl branch Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Error Codes
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.