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
base: master
from

Conversation

Projects
None yet
5 participants
@jvilk
Contributor

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
@jvilk

This comment has been minimized.

Contributor

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.

@lpinca

lpinca approved these changes Oct 10, 2016

LGTM

doc/api/errors.md Outdated
return the same value.
#### error.errno
Returns a number representing the error code, which may be referenced in

This comment has been minimized.

@gibfahn

gibfahn Oct 10, 2016

Member

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

@gibfahn

This comment has been minimized.

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.

John Vilk
doc: errno is a number, not a string
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 jvilk force-pushed the jvilk:master branch to a554d59 Oct 10, 2016

@jvilk

This comment has been minimized.

Contributor

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 added a commit to lpinca/node that referenced this pull request Oct 16, 2016

doc: specify that errno is a number, not a string
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

This comment has been minimized.

Member

lpinca commented Oct 16, 2016

Landed in f478b46.
Thank you!

@lpinca lpinca closed this Oct 16, 2016

jasnell added a commit that referenced this pull request Oct 17, 2016

doc: specify that errno is a number, not a string
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 added a commit that referenced this pull request Nov 11, 2016

doc: specify that errno is a number, not a string
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 added a commit that referenced this pull request Nov 11, 2016

doc: specify that errno is a number, not a string
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