Skip to content

Conversation

@starkwang
Copy link
Contributor

@starkwang starkwang commented Jul 1, 2017

The last argument of invalidArgType(name, expected, actual) in internal/errors.js is an actual value, NOT the type of actual value.

This causes:

path.format(123)
//=> TypeError [ERR_INVALID_ARG_TYPE]: The "pathObject" argument must be of type Object. Received type string

The last word "string" should be "number".

A parallel test is added for this method.

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

path

@nodejs-github-bot nodejs-github-bot added the path Issues and PRs related to the path subsystem. label Jul 1, 2017
if (pathObject === null || typeof pathObject !== 'object') {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'pathObject', 'Object',
typeof pathObject);
pathObject);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we align this with the argument above it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will exceed the maximum line length of 80

if (pathObject === null || typeof pathObject !== 'object') {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'pathObject', 'Object',
typeof pathObject);
pathObject);
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@cjihrig
Copy link
Contributor

cjihrig commented Jul 1, 2017

I think these fixes are already in #14011.

@starkwang starkwang closed this Jul 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

path Issues and PRs related to the path subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants