From c9f15a9b6c97b5dbf71d3f06afe817f438642f82 Mon Sep 17 00:00:00 2001 From: jecarroll Date: Tue, 9 Feb 2016 16:15:09 +0000 Subject: [PATCH] Suggested fix for Postgres errors causing node process to crash https://github.com/brianc/node-postgres/issues/746#issuecomment-13421947 0 --- lib/connection.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/connection.js b/lib/connection.js index f606de136..df0f26d02 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -106,7 +106,9 @@ Connection.prototype.attachListeners = function(stream) { if(self._emitMessage) { self.emit('message', msg); } - self.emit(msg.name, msg); + if(msg.name !== 'error') { + self.emit(msg.name, msg); + } packet = self._reader.read(); } });