diff --git a/lib/client.js b/lib/client.js index bd65c846..c4bd9df6 100644 --- a/lib/client.js +++ b/lib/client.js @@ -61,6 +61,10 @@ p.connect = function() { self.pulseQueryQueue(); }); + + con.on('error', function(error) { + self.emit('error', error); + }); }; p.pulseQueryQueue = function() { diff --git a/test/integration/client/error-handling-tests.js b/test/integration/client/error-handling-tests.js new file mode 100644 index 00000000..d3898c42 --- /dev/null +++ b/test/integration/client/error-handling-tests.js @@ -0,0 +1,10 @@ +var helper = require(__dirname + '/test-helper'); + +test('error handling', function(){ + var client = helper.client(); + client.query("select omfg from yodas_soda where pixistix = 'zoiks!!!'"); + assert.raises(client, 'error', function(error) { + assert.equal(error.severity, "ERROR"); + client.end(); + }); +});