-
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.
lib: migrate _http_outgoing.js's remaining errors
A couple of lib/_http_outgoing.js's errors were still in the "old style": `throw new Error(<some message here>)`. This commit migrates those 2 old style errors to the "new style": internal/errors.js's error-system. In the future, changes to these errors' messages won't break semver-major status. With the old style, changes to these errors' messages broke semver-major status. It was inconvenient. Refs: #17709 PR-URL: #17837 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Loading branch information
1 parent
9f122e3
commit d3ac18a
Showing
5 changed files
with
18 additions
and
16 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
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,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 | ||
} | ||
); |
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