Skip to content

Commit 7993f7d

Browse files
committed
Update qhelp example to more accurately demonstrate flagged cases
1 parent bf2f19d commit 7993f7d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

javascript/ql/src/Quality/examples/UnhandledStreamPipe.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ const fs = require('fs');
22
const source = fs.createReadStream('source.txt');
33
const destination = fs.createWriteStream('destination.txt');
44

5-
// Bad: No error handling
6-
source.pipe(destination);
5+
// Bad: Only destination has error handling, source errors are unhandled
6+
source.pipe(destination).on('error', (err) => {
7+
console.error('Destination error:', err);
8+
});

0 commit comments

Comments
 (0)