-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stream: destroy readable on read error
PR-URL: #39342 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
- Loading branch information
Showing
4 changed files
with
29 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 8 additions & 13 deletions
21
test/parallel/test-stream-readable-with-unimplemented-_read.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
'use strict'; | ||
require('../common'); | ||
|
||
const assert = require('assert'); | ||
const common = require('../common'); | ||
const { Readable } = require('stream'); | ||
|
||
const readable = new Readable(); | ||
|
||
assert.throws( | ||
() => { | ||
readable.read(); | ||
}, | ||
{ | ||
code: 'ERR_METHOD_NOT_IMPLEMENTED', | ||
name: 'Error', | ||
message: 'The _read() method is not implemented' | ||
} | ||
); | ||
readable.read(); | ||
readable.on('error', common.expectsError({ | ||
code: 'ERR_METHOD_NOT_IMPLEMENTED', | ||
name: 'Error', | ||
message: 'The _read() method is not implemented' | ||
})); | ||
readable.on('close', common.mustCall()); |