net: migrate errors to internal/errors#17766
Conversation
doc/api/errors.md
Outdated
There was a problem hiding this comment.
Nit: "Server" should probably be either in backticks or else lowercase. (Either it is referring to a server generically, in which case lowercase, or it is referring to the Server object, in which case backticks.)
doc/api/errors.md
Outdated
086f5f9 to
4f79622
Compare
|
@Trott |
There was a problem hiding this comment.
Can you use common.expectsError() to test this? This should be something like
common.expectsError({
code: 'ERR_SERVER_NOT_RUNNING',
message: 'Server is not running.',
type: Error
})(error);
There was a problem hiding this comment.
Same as above, please use common.expectsError
|
@joyeecheung |
There was a problem hiding this comment.
The common.mustCall is not necessary here. common.expectsError creates a function that can receive an error and also makes sure that it actually ran.
|
@apapirovski |
There was a problem hiding this comment.
This can be simplified to...
server.close(common.expectsError({
code: 'ERR_SERVER_NOT_RUNNING',
message: 'Server is not running.',
type: Error
}));|
@jasnell |
|
@kysnm .. there's no bother at all :-) thank you for doing this! |
|
There were some seemingly unrelated errors in the last CI. New CI: https://ci.nodejs.org/job/node-test-pull-request/12281/ |
|
Landed in b98aaa3, thanks! |
Throw ERR_SOCKET_CLOSED and ERR_SERVER_NOT_RUNNING instead of the old-style errors in net.js. PR-URL: #17766 Refs: #17709 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: #17709
cc @jasnell @joyeecheung
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
doc, errors, net