Skip to content

Commit 540cbf8

Browse files
evanlucasBridgeAR
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 <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>
1 parent 4a1a4bf commit 540cbf8

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)