Skip to content

Commit b2a2a57

Browse files
John VilkMyles Borins
John Vilk
authored and
Myles Borins
committed
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 <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 87285ed commit b2a2a57

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/api/errors.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,15 @@ added properties.
449449
### Class: System Error
450450

451451
#### error.code
452-
#### error.errno
453452

454453
Returns a string representing the error code, which is always `E` followed by
455454
a sequence of capital letters, and may be referenced in `man 2 intro`.
456455

457-
The properties `error.code` and `error.errno` are aliases of one another and
458-
return the same value.
456+
#### error.errno
457+
458+
Returns a number corresponding to the **negated** error code, which may be
459+
referenced in `man 2 intro`. For example, an `ENOENT` error has an `errno` of
460+
`-2` because the error code for `ENOENT` is `2`.
459461

460462
#### error.syscall
461463

0 commit comments

Comments
 (0)