Skip to content

Commit 30fa083

Browse files
committed
catching errors in once will still crash process
1 parent aff0b1c commit 30fa083

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var common = require('../../common');
2+
var assert = require('assert');
3+
4+
process.on('uncaughtException', function (err) {
5+
assert.ifError(err);
6+
});
7+
8+
var connection1 = common.createConnection({
9+
username: 'wtf',
10+
password: 'lol'
11+
});
12+
13+
// error will NOT bubble up to process level if `on` is used
14+
connection1.on('error', function (err) {
15+
assert.ok(err);
16+
});
17+
18+
var connection2 = common.createConnection({
19+
username: 'wtf',
20+
password: 'lol'
21+
});
22+
23+
// error will bubble up to process level if `once` is used
24+
connection2.once('error', function (err) {
25+
assert.ok(err);
26+
});

0 commit comments

Comments
 (0)