mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

Replace var to const/let, use common.mustCall on callbacks and move process.on('exit') to the .on('error') handler PR-URL: https://github.com/nodejs/node/pull/10025 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
13 lines
371 B
JavaScript
13 lines
371 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
// This should fail with an async EINVAL error, not throw an exception
|
|
net.createServer(common.fail)
|
|
.listen({fd: 0})
|
|
.on('error', common.mustCall(function(e) {
|
|
assert(e instanceof Error);
|
|
assert(['EINVAL', 'ENOTSOCK'].includes(e.code));
|
|
}));
|