From a26454ea326f5b58a55737d178c1aa0d687ca961 Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Fri, 9 Feb 2018 10:20:20 -0600 Subject: [PATCH] doc: add error check to fs example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the err passed to the callback of fs.open() was not checked. PR-URL: https://github.com/nodejs/node/pull/18681 Reviewed-By: Anatoli Papirovski Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- doc/api/fs.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 93744100057c57..9f9db8c5e75cc7 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -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 {