-
Notifications
You must be signed in to change notification settings - Fork 30k
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
net: migrate errors to internal/errors #17766
Changes from 1 commit
0419699
614792b
9f60c2c
4f79622
37711dd
7832c2f
3cf5f8f
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 |
---|---|---|
|
@@ -1355,6 +1355,12 @@ The [`server.listen()`][] method was called while a `net.Server` was already | |
listening. This applies to all instances of `net.Server`, including HTTP, HTTPS, | ||
and HTTP/2 Server instances. | ||
|
||
<a id="ERR_SERVER_NOT_RUNNING"></a> | ||
### ERR_SERVER_NOT_RUNNING | ||
|
||
The [`server.close()`][] method was called when a `net.Server` was not running. This applies to all instances of `net.Server`, including HTTP, HTTPS, | ||
and HTTP/2 Server instances. | ||
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. 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 |
||
|
||
<a id="ERR_SOCKET_ALREADY_BOUND"></a> | ||
### ERR_SOCKET_ALREADY_BOUND | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ server.listen(common.PIPE, common.mustCall(function() { | |
server.close(common.mustCall(function(error) { | ||
assert.strictEqual(error, undefined); | ||
server.close(common.mustCall(function(error) { | ||
assert.strictEqual(error && error.message, 'Not running'); | ||
assert.strictEqual(error && error.code, 'ERR_SERVER_NOT_RUNNING'); | ||
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. Can you use
|
||
})); | ||
})); | ||
})); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,10 @@ server.listen(0, common.mustCall(function() { | |
// Test destroy returns this, even on multiple calls when it short-circuits. | ||
assert.strictEqual(conn, conn.destroy().destroy()); | ||
conn.on('error', common.mustCall(function(err) { | ||
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 |
||
assert.strictEqual(err.message, 'This socket is closed'); | ||
assert.strictEqual(err.code, 'ERR_SOCKET_CLOSED'); | ||
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. Same as above, please use |
||
})); | ||
conn.write(Buffer.from('kaboom'), common.mustCall(function(err) { | ||
assert.strictEqual(err.message, 'This socket is closed'); | ||
assert.strictEqual(err.code, 'ERR_SOCKET_CLOSED'); | ||
})); | ||
server.close(); | ||
})); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,7 @@ const net = require('net'); | |
const client = net.connect({ port }, common.mustCall(() => { | ||
client.on('error', common.mustCall((err) => { | ||
server.close(); | ||
assert.strictEqual(err.constructor, Error); | ||
assert.strictEqual(err.message, 'This socket is closed'); | ||
assert.strictEqual(err.code, 'ERR_SOCKET_CLOSED'); | ||
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. Ditto |
||
})); | ||
client._handle.close(); | ||
client._handle = null; | ||
|
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.
Wrap at 80 chars?