-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib, test: migrate _http_outgoing.js's remaining errors to internal/errors.js #17837
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,17 @@ | |
|
||
const common = require('../common'); | ||
const http = require('http'); | ||
const assert = require('assert'); | ||
|
||
// Fix for https://github.com/nodejs/node/issues/14368 | ||
|
||
const server = http.createServer(handle); | ||
|
||
function handle(req, res) { | ||
res.on('error', common.mustCall((err) => { | ||
assert.strictEqual(err.message, 'write after end'); | ||
common.expectsError({ | ||
code: 'ERR_STREAM_WRITE_AFTER_END', | ||
type: Error | ||
})(err); | ||
server.close(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never mind. I thought I could remove the That's what I did in However, I can't. This block performs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way to handle that would be to register two on('error') handlers, one with the |
||
})); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
'use strict'; | ||
const assert = require('assert'); | ||
const common = require('../common'); | ||
const OutgoingMessage = require('_http_outgoing').OutgoingMessage; | ||
|
||
// Verify that an error is thrown upon a call to `OutgoingMessage.pipe`. | ||
|
||
const outgoingMessage = new OutgoingMessage(); | ||
assert.throws( | ||
common.mustCall(() => { outgoingMessage.pipe(outgoingMessage); }), | ||
(err) => { | ||
return ((err instanceof Error) && /Cannot pipe, not readable/.test(err)); | ||
}, | ||
'OutgoingMessage.pipe should throw an error' | ||
common.expectsError( | ||
() => { outgoingMessage.pipe(outgoingMessage); }, | ||
{ | ||
code: 'ERR_STREAM_CANNOT_PIPE', | ||
type: Error | ||
} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I missed this. I'll fix it soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^ Addressed this remark in the comment below.