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

You need to sign in or sign up before continuing.
Commit 5c050202 by Brian Romanko

Fixing stack trace capturing and switching back to util.inerhits

1 parent 43a43edc
Showing with 5 additions and 12 deletions
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* @fileOverview The Error Objects produced by Sequelize. * @fileOverview The Error Objects produced by Sequelize.
*/ */
var util = require('util');
var error = module.exports = {}; var error = module.exports = {};
/** /**
...@@ -15,14 +16,10 @@ error.BaseError = function() { ...@@ -15,14 +16,10 @@ error.BaseError = function() {
var tmp = Error.apply(this, arguments); var tmp = Error.apply(this, arguments);
tmp.name = this.name = 'SequelizeBaseError'; tmp.name = this.name = 'SequelizeBaseError';
this.stack = tmp.stack; Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
this.message = tmp.message; this.message = tmp.message;
return this;
}; };
error.BaseError.prototype = Object.create(Error.prototype, { util.inherits(error.BaseError, Error);
constructor: { value: error.BaseError }
});
/** /**
...@@ -34,12 +31,8 @@ error.ValidationError = function(message, errors) { ...@@ -34,12 +31,8 @@ error.ValidationError = function(message, errors) {
error.BaseError.apply(this, arguments); error.BaseError.apply(this, arguments);
this.name = 'SequelizeValidationError'; this.name = 'SequelizeValidationError';
this.errors = errors || []; this.errors = errors || [];
return this;
}; };
error.ValidationError.prototype = Object.create(error.BaseError.prototype, { util.inherits(error.ValidationError, error.BaseError);
constructor: { value: error.ValidationError }
});
/** /**
* Finds all validation error items for the path specified. * Finds all validation error items for the path specified.
......
...@@ -31,7 +31,7 @@ describe(Support.getTestDialectTeaser("Sequelize Errors"), function () { ...@@ -31,7 +31,7 @@ describe(Support.getTestDialectTeaser("Sequelize Errors"), function () {
expect(validationError).to.be.instanceOf(Sequelize.ValidationError); expect(validationError).to.be.instanceOf(Sequelize.ValidationError);
expect(validationError).to.be.instanceOf(Error); expect(validationError).to.be.instanceOf(Error);
expect(validationError).to.have.property('name', 'SequelizeValidationError'); expect(validationError).to.have.property('name', 'SequelizeValidationError');
expect(instError).to.be.instanceOf(Sequelize.Error); expect(instError).to.be.instanceOf(Sequelize.Error);
expect(instError).to.be.instanceOf(Error); expect(instError).to.be.instanceOf(Error);
expect(instValidationError).to.be.instanceOf(Sequelize.ValidationError); expect(instValidationError).to.be.instanceOf(Sequelize.ValidationError);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!