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 Feb 21, 2018
1 parent 080368b commit 3cfb313
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 @@ -1397,6 +1397,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 3cfb313

Please sign in to comment.