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, console: migrate to use internal/errors.js #11308

Closed

Conversation

slammayjammay
Copy link
Contributor

Migrate lib/console.js to use internal/errors.js.

Refs: #11273

cc @jasnell

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)

errors, console

@nodejs-github-bot nodejs-github-bot added console Issues and PRs related to the console subsystem. errors Issues and PRs related to JavaScript errors originated in Node.js core. labels Feb 11, 2017
@@ -575,6 +629,7 @@ found [here][online].
[domains]: domain.html
[event emitter-based]: events.html#events_class_eventemitter
[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor
[Node.js Error Codes]: #nodejs-error-codes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be _ not -. You can confirm this by building the docs locally, with make docopen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked and #nodejs-error-codes works.

@thefourtheye
Copy link
Contributor

Related: #11319 also has an implementation for invalidArgType.

@jasnell
Copy link
Member

jasnell commented Feb 12, 2017

Yes, some duplication across these is fine. We'll sort it out by rebasing as things get landed.

@jasnell jasnell added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 14, 2017

function Console(stdout, stderr) {
if (!(this instanceof Console)) {
return new Console(stdout, stderr);
}
if (!stdout || typeof stdout.write !== 'function') {
throw new TypeError('Console expects a writable stream instance');
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'stdout', 'WriteStream');
Copy link
Member

@joyeecheung joyeecheung Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, wait, WriteStream is not an actual type or class name (at least the constructor of writable stream from our stream module is named Writable). Is it OK to pass a descriptive type (like "writable stream") to the formatter of ERR_INVALID_ARG_TYPE? @jasnell

Copy link
Member

@joyeecheung joyeecheung Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, there are tty.WriteStream and fs.WriteStream, but then those subclass Writable and the condition here even only checks .write, not instanceof.

@jasnell jasnell added the blocked PRs that are blocked by other issues or PRs. label Apr 5, 2017
@fhinkel
Copy link
Member

fhinkel commented Jun 7, 2017

I'm closing this because it's been inactive for quite a while. Feel free to reopen or ping a collaborator to get it reopened if needed.

@fhinkel fhinkel closed this Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked PRs that are blocked by other issues or PRs. console Issues and PRs related to the console subsystem. errors Issues and PRs related to JavaScript errors originated in Node.js core. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants