不要怂,就是干,撸起袖子干!

Commit aa806860 by Mick Hansen

Merge pull request #3280 from mbroadst/mssql-error-handling

prevent tedious errors from taking down app
2 parents ec3b327c 317032ef
Showing with 5 additions and 0 deletions
...@@ -47,6 +47,11 @@ ConnectionManager.prototype.connect = function(config) { ...@@ -47,6 +47,11 @@ ConnectionManager.prototype.connect = function(config) {
var connection = new self.lib.Connection(connectionConfig); var connection = new self.lib.Connection(connectionConfig);
connection.lib = self.lib; connection.lib = self.lib;
// don't let tedious errors take down the entire application
connection.on('error', function(err) {
connection._invalid = true;
});
connection.on('connect', function(err) { connection.on('connect', function(err) {
if (!err) { if (!err) {
resolve(connection); resolve(connection);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!