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

Commit b1a86cf7 by Stuart P. Bentley

Fix "the dialect is not supported" error

This makes it so that, if the provided dialect is a supported dialect (eg. postgres) and requiring the dialect throws an error (eg. the 'pg' package not being installed), the actual underlying error and its accompanying stack trace are thrown to the caller, rather than stringifying the error (losing the stack) and reporting the wrong error.
1 parent 7330ad8b
Showing with 2 additions and 4 deletions
...@@ -188,7 +188,6 @@ var Sequelize = function(database, username, password, options) { ...@@ -188,7 +188,6 @@ var Sequelize = function(database, username, password, options) {
dialectOptions: this.options.dialectOptions dialectOptions: this.options.dialectOptions
}; };
try {
var Dialect; var Dialect;
// Requiring the dialect in a switch-case to keep the // Requiring the dialect in a switch-case to keep the
// require calls static. (Browserify fix) // require calls static. (Browserify fix)
...@@ -208,11 +207,10 @@ var Sequelize = function(database, username, password, options) { ...@@ -208,11 +207,10 @@ var Sequelize = function(database, username, password, options) {
case 'sqlite': case 'sqlite':
Dialect = require('./dialects/sqlite'); Dialect = require('./dialects/sqlite');
break; break;
default:
throw new Error('The dialect ' + this.getDialect() + ' is not supported. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite.');
} }
this.dialect = new Dialect(this); this.dialect = new Dialect(this);
} catch (err) {
throw new Error('The dialect ' + this.getDialect() + ' is not supported. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite. ('+err+')');
}
this.dialect.QueryGenerator.typeValidation = options.typeValidation; this.dialect.QueryGenerator.typeValidation = options.typeValidation;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!