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: nodejs#18681
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
  • Loading branch information
evanlucas authored and MayaLekova committed May 8, 2018
1 parent 5ba4a09 commit a17d580
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 a17d580

Please sign in to comment.