| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -580,6 +580,11 @@ by the `assert` module. | |||
| 580 | 580 | ||
| 581 | 581 | Used when attempting to perform an operation outside the bounds of a `Buffer`. | |
| 582 | 582 | ||
| 583 | + <a id="ERR_CHILD_CLOSED_BEFORE_REPLY"></a> | ||
| 584 | + ### ERR_CHILD_CLOSED_BEFORE_REPLY | ||
| 585 | + | ||
| 586 | + Used when a child process is closed before the parent received a reply. | ||
| 587 | + | ||
| 583 | 588 | <a id="ERR_CONSOLE_WRITABLE_STREAM"></a> | |
| 584 | 589 | ### ERR_CONSOLE_WRITABLE_STREAM | |
| 585 | 590 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,6 +102,7 @@ module.exports = exports = { | |||
| 102 | 102 | E('ERR_ARG_NOT_ITERABLE', '%s must be iterable'); | |
| 103 | 103 | E('ERR_ASSERTION', '%s'); | |
| 104 | 104 | E('ERR_BUFFER_OUT_OF_BOUNDS', bufferOutOfBounds); | |
| 105 | + E('ERR_CHILD_CLOSED_BEFORE_REPLY', 'Child closed before reply received'); | ||
| 105 | 106 | E('ERR_CONSOLE_WRITABLE_STREAM', | |
| 106 | 107 | 'Console expects a writable stream instance for %s'); | |
| 107 | 108 | E('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s'); | |
@@ -183,7 +184,7 @@ E('ERR_UNKNOWN_STDIN_TYPE', 'Unknown stdin file type'); | |||
| 183 | 184 | E('ERR_UNKNOWN_STREAM_TYPE', 'Unknown stream file type'); | |
| 184 | 185 | E('ERR_V8BREAKITERATOR', 'Full ICU data not installed. ' + | |
| 185 | 186 | 'See https://github.com/nodejs/node/wiki/Intl'); | |
| 186 | - // Add new errors from here... | ||
| 187 | + | ||
| 187 | 188 | ||
| 188 | 189 | function invalidArgType(name, expected, actual) { | |
| 189 | 190 | assert(name, 'name is required'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,7 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | + const errors = require('internal/errors'); | ||
| 4 | + | ||
| 3 | 5 | const EventEmitter = require('events'); | |
| 4 | 6 | ||
| 5 | 7 | // This object keeps track of the sockets that are sent | |
@@ -18,7 +20,7 @@ class SocketListSend extends EventEmitter { | |||
| 18 | 20 | ||
| 19 | 21 | function onclose() { | |
| 20 | 22 | self.child.removeListener('internalMessage', onreply); | |
| 21 | - callback(new Error('child closed before reply')); | ||
| 23 | + callback(new errors.Error('ERR_CHILD_CLOSED_BEFORE_REPLY')); | ||
| 22 | 24 | } | |
| 23 | 25 | ||
| 24 | 26 | function onreply(msg) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,11 @@ const key = 'test-key'; | |||
| 17 | 17 | const list = new SocketListSend(child, 'test'); | |
| 18 | 18 | ||
| 19 | 19 | list._request('msg', 'cmd', common.mustCall((err) => { | |
| 20 | - assert.strictEqual(err.message, 'child closed before reply'); | ||
| 20 | + common.expectsError({ | ||
| 21 | + code: 'ERR_CHILD_CLOSED_BEFORE_REPLY', | ||
| 22 | + type: Error, | ||
| 23 | + message: 'Child closed before reply received' | ||
| 24 | + })(err); | ||
| 21 | 25 | assert.strictEqual(child.listenerCount('internalMessage'), 0); | |
| 22 | 26 | })); | |
| 23 | 27 | } | |
@@ -55,7 +59,11 @@ const key = 'test-key'; | |||
| 55 | 59 | const list = new SocketListSend(child, key); | |
| 56 | 60 | ||
| 57 | 61 | list._request('msg', 'cmd', common.mustCall((err) => { | |
| 58 | - assert.strictEqual(err.message, 'child closed before reply'); | ||
| 62 | + common.expectsError({ | ||
| 63 | + code: 'ERR_CHILD_CLOSED_BEFORE_REPLY', | ||
| 64 | + type: Error, | ||
| 65 | + message: 'Child closed before reply received' | ||
| 66 | + })(err); | ||
| 59 | 67 | assert.strictEqual(child.listenerCount('internalMessage'), 0); | |
| 60 | 68 | })); | |
| 61 | 69 | } | |
@@ -119,7 +127,7 @@ const key = 'test-key'; | |||
| 119 | 127 | const count = 1; | |
| 120 | 128 | const child = Object.assign(new EventEmitter(), { | |
| 121 | 129 | connected: true, | |
| 122 | - send: function(msg) { | ||
| 130 | + send: function() { | ||
| 123 | 131 | process.nextTick(() => { | |
| 124 | 132 | this.emit('disconnect'); | |
| 125 | 133 | this.emit('internalMessage', { key, count, cmd: 'NODE_SOCKET_COUNT' }); | |
@@ -129,8 +137,12 @@ const key = 'test-key'; | |||
| 129 | 137 | ||
| 130 | 138 | const list = new SocketListSend(child, key); | |
| 131 | 139 | ||
| 132 | - list.getConnections(common.mustCall((err, msg) => { | ||
| 133 | - assert.strictEqual(err.message, 'child closed before reply'); | ||
| 140 | + list.getConnections(common.mustCall((err) => { | ||
| 141 | + common.expectsError({ | ||
| 142 | + code: 'ERR_CHILD_CLOSED_BEFORE_REPLY', | ||
| 143 | + type: Error, | ||
| 144 | + message: 'Child closed before reply received' | ||
| 145 | + })(err); | ||
| 134 | 146 | assert.strictEqual(child.listenerCount('internalMessage'), 0); | |
| 135 | 147 | })); | |
| 136 | 148 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments