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

doc: errno is a number, not a string #9007

Closed
wants to merge 1 commit into from
Closed

Conversation

jvilk
Copy link

@jvilk jvilk commented Oct 10, 2016

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

The documentation erroneously described the errno property as an alias for the
code property, but that is not the case in the implementation. errno is the
error code of the error as a number, and code is the error code of the error
as a string.

As proof, here's some code:

fs.readFile("nonexistantdjkfald", function(e) {
  console.log(e.errno); 
  console.log(typeof(e.errno));
  console.log(e.code);
  console.log(typeof(e.code));
});

Output:

-2
number
ENOENT
string

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. errors Issues and PRs related to JavaScript errors originated in Node.js core. labels Oct 10, 2016
@jvilk
Copy link
Author

jvilk commented Oct 10, 2016

Note: Since this documentation change is relevant to currently released versions of Node, it should probably be backported to relevant branches.

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

LGTM

return the same value.
#### error.errno

Returns a number representing the error code, which may be referenced in
Copy link
Member

Choose a reason for hiding this comment

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

Maybe Returns a number corresponding to an error code ? LGTM either way.

@gibfahn
Copy link
Member

gibfahn commented Oct 10, 2016

Also it's a small thing, but if you could wrap your commit message at 72 chars that'd be great.

The documentation erroneously described the errno property as an alias
for the code property, but that is not the case in the implementation.
errno is the error code of the error as a number, and code is the error
code of the error as a string.
@jvilk
Copy link
Author

jvilk commented Oct 10, 2016

@gibfahn I have clarified the documentation, and fixed the commit message. Please note that I have added extra information since the last commit. Node negates the error code, so an error code of 2 becomes -2. I hope the new text is understandable; if not, I am open to editing suggestions! :)

lpinca pushed a commit to lpinca/node that referenced this pull request Oct 16, 2016
The documentation erroneously described the errno property as an alias
for the code property, but that is not the case in the implementation.
errno is the error code of the error as a number, and code is the error
code of the error as a string.

PR-URL: nodejs#9007
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
@lpinca
Copy link
Member

lpinca commented Oct 16, 2016

Landed in f478b46.
Thank you!

@lpinca lpinca closed this Oct 16, 2016
jasnell pushed a commit that referenced this pull request Oct 17, 2016
The documentation erroneously described the errno property as an alias
for the code property, but that is not the case in the implementation.
errno is the error code of the error as a number, and code is the error
code of the error as a string.

PR-URL: #9007
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 11, 2016
The documentation erroneously described the errno property as an alias
for the code property, but that is not the case in the implementation.
errno is the error code of the error as a number, and code is the error
code of the error as a string.

PR-URL: #9007
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 11, 2016
The documentation erroneously described the errno property as an alias
for the code property, but that is not the case in the implementation.
errno is the error code of the error as a number, and code is the error
code of the error as a string.

PR-URL: #9007
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This was referenced Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. errors Issues and PRs related to JavaScript errors originated in Node.js core.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants