Skip to content

Commit 3cfb313

Browse files
evanlucasMylesBorins
authored andcommitted
doc: add error check to fs example
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]>
1 parent 080368b commit 3cfb313

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

doc/api/fs.md

+1
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,7 @@ fs.open('myfile', 'wx', (err, fd) => {
13971397
fs.exists('myfile', (exists) => {
13981398
if (exists) {
13991399
fs.open('myfile', 'r', (err, fd) => {
1400+
if (err) throw err;
14001401
readMyData(fd);
14011402
});
14021403
} else {

0 commit comments

Comments
 (0)