Skip to content

Commit

Permalink
doc: add error check to fs example
Browse files Browse the repository at this point in the history
Previously, the err passed to the callback of fs.open() was not checked.

PR-URL: #18681
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
evanlucas authored and MylesBorins committed Aug 16, 2018
1 parent bf2daab commit a26454e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@ fs.open('myfile', 'wx', (err, fd) => {
fs.exists('myfile', (exists) => {
if (exists) {
fs.open('myfile', 'r', (err, fd) => {
if (err) throw err;
readMyData(fd);
});
} else {
Expand Down

0 comments on commit a26454e

Please sign in to comment.