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

lib: inconsistent initial of expected in TypeError[ERR_INVALID_ARG_TYPE] #16383

Closed
starkwang opened this issue Oct 22, 2017 · 2 comments
Closed
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core.

Comments

@starkwang
Copy link
Contributor

The initials of expected in TypeError[ERR_INVALID_ARG_TYPE] are inconsistent. Some codes are using uppercase for primitive types and some are using lowercase:

For example, uppercase:
https://github.com/nodejs/node/blob/master/lib/_tls_common.js#L61
https://github.com/nodejs/node/blob/master/lib/internal/child_process.js#L295

Lowercase :
https://github.com/nodejs/node/blob/master/lib/buffer.js#L201
https://github.com/nodejs/node/blob/master/lib/fs.js#L1865

It‘s a little bit of chaos. Should we unify them?

  • Version: master
  • Platform: all
  • Subsystem: internal/errors, lib
@addaleax addaleax added the errors Issues and PRs related to JavaScript errors originated in Node.js core. label Oct 22, 2017
@addaleax
Copy link
Member

Lowercase array seems like a bug here, thanks for catching that!

Generally, we should try to do the same thing the documentation does; use lowercase for primitive types, uppercase for classes.

@starkwang
Copy link
Contributor Author

@addaleax What about function? It is not primitive type but we are using 'function'.

evanlucas pushed a commit that referenced this issue Nov 13, 2017
The initials of expected in TypeError[ERR_INVALID_ARG_TYPE]
are inconsistent. This change is to unify them.

PR-URL: #16401
Fixes: #16383
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants