mirror of https://github.com/lukechilds/node.git
Browse Source
Turn a `CHECK()` that could be brought to fail using public APIs into throwing an error. Fixes: https://github.com/nodejs/node/issues/12152 PR-URL: https://github.com/nodejs/node/pull/12753 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>v6.x
committed by
Myles Borins
2 changed files with 20 additions and 1 deletions
@ -0,0 +1,14 @@ |
|||||
|
'use strict'; |
||||
|
const common = require('../common'); |
||||
|
const assert = require('assert'); |
||||
|
const net = require('net'); |
||||
|
|
||||
|
const server = net.createServer().listen(0, common.mustCall(() => { |
||||
|
const client = net.connect(server.address().port, common.mustCall(() => { |
||||
|
assert.throws(() => { |
||||
|
client.write('broken', 'buffer'); |
||||
|
}, /^TypeError: Second argument must be a buffer$/); |
||||
|
client.destroy(); |
||||
|
server.close(); |
||||
|
})); |
||||
|
})); |
Loading…
Reference in new issue