From b5d02a995aeb4a4f1828204a0ba0a2a02fa80eb0 Mon Sep 17 00:00:00 2001 From: brianc Date: Tue, 26 Oct 2010 01:51:12 -0500 Subject: [PATCH] basic test for client error handling --- lib/client.js | 4 ++++ test/integration/client/error-handling-tests.js | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/integration/client/error-handling-tests.js 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(); + }); +});