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

Commit ffc35bb1 by David Pate

Added logic for when an error doesn't have an `code` property.

1 parent 9ef2cf55
Showing with 4 additions and 0 deletions
...@@ -41,6 +41,7 @@ ConnectionManager.prototype.connect = function(config) { ...@@ -41,6 +41,7 @@ ConnectionManager.prototype.connect = function(config) {
connection.connect(function(err) { connection.connect(function(err) {
if (err) { if (err) {
if (err.code) {
switch (err.code) { switch (err.code) {
case 'ECONNREFUSED': case 'ECONNREFUSED':
reject(new sequelizeErrors.ConnectionRefusedError(err)); reject(new sequelizeErrors.ConnectionRefusedError(err));
...@@ -61,6 +62,9 @@ ConnectionManager.prototype.connect = function(config) { ...@@ -61,6 +62,9 @@ ConnectionManager.prototype.connect = function(config) {
reject(new sequelizeErrors.ConnectionError(err)); reject(new sequelizeErrors.ConnectionError(err));
break; break;
} }
} else {
reject(new sequelizeErrors.ConnectionError(err));
}
return; return;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!