Closed
Description
I'm working on error catching a postgres condition when the server is not available. The first time, everything works fine. The error is passed in and I can check for it and I'm set.
The second pass in hangs the at the connection line and I never get to the callback to get the error.
console.log('about to connect');
pg.connect(DBSTRING, function(err, client) {
if (err) {
console.log("ERROR DB " + err.message);
stream.write(err.message);
} else {
// do query and such
}
});
Is the bit of code I'm working with. The about to connect is dumped on every request in, but the callback only seems to occur every other pass into here. Am I missing something in the error handling? Is there something I can check?
Thanks