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

Commit c032ec90 by Felix Becker Committed by Jan Aagaard Meier

ES6 refactor: errors (#6040)

* ES6 refactor of errors.js

Use classes and export

* Add stack trace test
1 parent dc5a38f2
'use strict';
/* jshint expr: true */
const errors = require('../../lib/errors');
const expect = require('chai').expect;
describe('errors', () => {
it('should maintain stack trace', () => {
function throwError() {
throw new errors.ValidationError('this is a message');
}
let err;
try {
throwError();
} catch (error) {
err = error;
}
expect(err).to.exist;
const stackParts = err.stack.split('\n');
expect(stackParts[0]).to.equal('SequelizeValidationError: this is a message');
expect(stackParts[1]).to.match(/^ at throwError \(.*errors.test.js:\d+:\d+\)$/);
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!