-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stream: writable don't throw multiple callback error
Align ERR_MULTIPLE_CALLBACK in Writable with the rest of error handling as well as how the error is implemented in Transform.
- Loading branch information
Showing
2 changed files
with
18 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { Writable } = require('stream'); | ||
const stream = new Writable({ | ||
write(chunk, enc, cb) { cb(); cb(); } | ||
}); | ||
|
||
stream.on('error', common.expectsError({ | ||
type: Error, | ||
message: 'Callback called multiple times', | ||
code: 'ERR_MULTIPLE_CALLBACK' | ||
})); | ||
|
||
stream.write('foo'); |