Skip to content

Commit 9d773a2

Browse files
committed
Merge pull request brianc#387 from brianc/issues/350
Ensure error being returned to native client
2 parents 95a5bba + d3ba322 commit 9d773a2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/binding.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ class Connection : public ObjectWrap {
8787
TRACE("Received IO event");
8888

8989
if(status == -1) {
90-
LOG("Connection error.");
91-
return;
90+
TRACE("Connection error. -1 status from lib_uv_poll");
9291
}
9392

9493
Connection *connection = static_cast<Connection*>(w->data);

test/integration/client/error-handling-tests.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,22 @@ test('non-error calls supplied callback', function() {
114114
});
115115

116116
test('when connecting to invalid host', function() {
117-
return false;
118117
var client = new Client({
119118
user: 'aslkdjfsdf',
120119
password: '1234',
121120
host: 'asldkfjasdf!!#1308140.com'
122121
});
123-
assert.emits(client, 'error');
122+
var delay = 5000;
123+
var tid = setTimeout(function() {
124+
assert(false, "When connecting to an invalid host the error event should be emitted but it has been " + delay + " and still no error event.");
125+
}, delay);
126+
client.on('error', function() {
127+
clearTimeout(tid);
128+
})
124129
client.connect();
125130
});
126131

127132
test('when connecting to invalid host with callback', function() {
128-
return false;
129133
var client = new Client({
130134
user: 'brian',
131135
password: '1234',

0 commit comments

Comments
 (0)