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

Commit 345eb898 by Simon Schick

refactor(errors): remove redundant stack trace capturing

1 parent ed9bf350
...@@ -9,7 +9,6 @@ class AssociationError extends BaseError { ...@@ -9,7 +9,6 @@ class AssociationError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeAssociationError'; this.name = 'SequelizeAssociationError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -11,7 +11,6 @@ class BaseError extends Error { ...@@ -11,7 +11,6 @@ class BaseError extends Error {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeBaseError'; this.name = 'SequelizeBaseError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -15,7 +15,6 @@ class BulkRecordError extends BaseError { ...@@ -15,7 +15,6 @@ class BulkRecordError extends BaseError {
this.name = 'SequelizeBulkRecordError'; this.name = 'SequelizeBulkRecordError';
this.errors = error; this.errors = error;
this.record = record; this.record = record;
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -15,7 +15,6 @@ class ConnectionError extends BaseError { ...@@ -15,7 +15,6 @@ class ConnectionError extends BaseError {
*/ */
this.parent = parent; this.parent = parent;
this.original = parent; this.original = parent;
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class AccessDeniedError extends ConnectionError { ...@@ -9,7 +9,6 @@ class AccessDeniedError extends ConnectionError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeAccessDeniedError'; this.name = 'SequelizeAccessDeniedError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class ConnectionAcquireTimeoutError extends ConnectionError { ...@@ -9,7 +9,6 @@ class ConnectionAcquireTimeoutError extends ConnectionError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeConnectionAcquireTimeoutError'; this.name = 'SequelizeConnectionAcquireTimeoutError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class ConnectionRefusedError extends ConnectionError { ...@@ -9,7 +9,6 @@ class ConnectionRefusedError extends ConnectionError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeConnectionRefusedError'; this.name = 'SequelizeConnectionRefusedError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class ConnectionTimedOutError extends ConnectionError { ...@@ -9,7 +9,6 @@ class ConnectionTimedOutError extends ConnectionError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeConnectionTimedOutError'; this.name = 'SequelizeConnectionTimedOutError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class HostNotFoundError extends ConnectionError { ...@@ -9,7 +9,6 @@ class HostNotFoundError extends ConnectionError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeHostNotFoundError'; this.name = 'SequelizeHostNotFoundError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class HostNotReachableError extends ConnectionError { ...@@ -9,7 +9,6 @@ class HostNotReachableError extends ConnectionError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeHostNotReachableError'; this.name = 'SequelizeHostNotReachableError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class InvalidConnectionError extends ConnectionError { ...@@ -9,7 +9,6 @@ class InvalidConnectionError extends ConnectionError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeInvalidConnectionError'; this.name = 'SequelizeInvalidConnectionError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -22,7 +22,6 @@ class DatabaseError extends BaseError { ...@@ -22,7 +22,6 @@ class DatabaseError extends BaseError {
* @type {string} * @type {string}
*/ */
this.sql = parent.sql; this.sql = parent.sql;
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -17,7 +17,6 @@ class ExclusionConstraintError extends DatabaseError { ...@@ -17,7 +17,6 @@ class ExclusionConstraintError extends DatabaseError {
this.constraint = options.constraint; this.constraint = options.constraint;
this.fields = options.fields; this.fields = options.fields;
this.table = options.table; this.table = options.table;
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -19,7 +19,6 @@ class ForeignKeyConstraintError extends DatabaseError { ...@@ -19,7 +19,6 @@ class ForeignKeyConstraintError extends DatabaseError {
this.value = options.value; this.value = options.value;
this.index = options.index; this.index = options.index;
this.reltype = options.reltype; this.reltype = options.reltype;
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class TimeoutError extends DatabaseError { ...@@ -9,7 +9,6 @@ class TimeoutError extends DatabaseError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeTimeoutError'; this.name = 'SequelizeTimeoutError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -17,7 +17,6 @@ class UnknownConstraintError extends DatabaseError { ...@@ -17,7 +17,6 @@ class UnknownConstraintError extends DatabaseError {
this.constraint = options.constraint; this.constraint = options.constraint;
this.fields = options.fields; this.fields = options.fields;
this.table = options.table; this.table = options.table;
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class EagerLoadingError extends BaseError { ...@@ -9,7 +9,6 @@ class EagerLoadingError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeEagerLoadingError'; this.name = 'SequelizeEagerLoadingError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class EmptyResultError extends BaseError { ...@@ -9,7 +9,6 @@ class EmptyResultError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeEmptyResultError'; this.name = 'SequelizeEmptyResultError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class InstanceError extends BaseError { ...@@ -9,7 +9,6 @@ class InstanceError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeInstanceError'; this.name = 'SequelizeInstanceError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -26,7 +26,6 @@ class OptimisticLockError extends BaseError { ...@@ -26,7 +26,6 @@ class OptimisticLockError extends BaseError {
* @type {object} * @type {object}
*/ */
this.where = options.where; this.where = options.where;
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class QueryError extends BaseError { ...@@ -9,7 +9,6 @@ class QueryError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeQueryError'; this.name = 'SequelizeQueryError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -9,7 +9,6 @@ class SequelizeScopeError extends BaseError { ...@@ -9,7 +9,6 @@ class SequelizeScopeError extends BaseError {
constructor(parent) { constructor(parent) {
super(parent); super(parent);
this.name = 'SequelizeScopeError'; this.name = 'SequelizeScopeError';
Error.captureStackTrace(this, this.constructor);
} }
} }
......
...@@ -30,7 +30,6 @@ class ValidationError extends BaseError { ...@@ -30,7 +30,6 @@ class ValidationError extends BaseError {
} else if (this.errors.length > 0 && this.errors[0].message) { } else if (this.errors.length > 0 && this.errors[0].message) {
this.message = this.errors.map(err => `${err.type || err.origin}: ${err.message}`).join(',\n'); this.message = this.errors.map(err => `${err.type || err.origin}: ${err.message}`).join(',\n');
} }
Error.captureStackTrace(this, this.constructor);
} }
/** /**
......
...@@ -19,7 +19,6 @@ class UniqueConstraintError extends ValidationError { ...@@ -19,7 +19,6 @@ class UniqueConstraintError extends ValidationError {
this.parent = options.parent; this.parent = options.parent;
this.original = options.parent; this.original = options.parent;
this.sql = options.parent.sql; this.sql = options.parent.sql;
Error.captureStackTrace(this, this.constructor);
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!