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 <[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 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.