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

Commit ea8e6316 by Gabe Gorelick Committed by Jan Aagaard Meier

fix(errors): spurious Bluebird warnings (#8408)

The way Sequelize instantiates some of its Error subclasses
confuses Bluebird into thinking that Promises are rejected
with non-Error objects.

See https://github.com/petkaantonov/bluebird/issues/990
1 parent 360ddeca
Showing with 1 additions and 9 deletions
...@@ -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';
this.message = message;
Error.captureStackTrace(this, this.constructor); Error.captureStackTrace(this, this.constructor);
} }
} }
...@@ -86,7 +85,6 @@ class OptimisticLockError extends BaseError { ...@@ -86,7 +85,6 @@ class OptimisticLockError extends BaseError {
options.message = options.message || 'Attempting to update a stale model instance: ' + options.modelName; options.message = options.message || 'Attempting to update a stale model instance: ' + options.modelName;
super(options); super(options);
this.name = 'SequelizeOptimisticLockError'; this.name = 'SequelizeOptimisticLockError';
this.message = options.message;
/** /**
* The name of the model on which the update was attempted * The name of the model on which the update was attempted
* @type {string} * @type {string}
...@@ -156,7 +154,6 @@ class UniqueConstraintError extends ValidationError { ...@@ -156,7 +154,6 @@ class UniqueConstraintError extends ValidationError {
super(options.message, options.errors); super(options.message, options.errors);
this.name = 'SequelizeUniqueConstraintError'; this.name = 'SequelizeUniqueConstraintError';
this.message = options.message;
this.errors = options.errors; this.errors = options.errors;
this.fields = options.fields; this.fields = options.fields;
this.parent = options.parent; this.parent = options.parent;
...@@ -200,7 +197,7 @@ class ExclusionConstraintError extends DatabaseError { ...@@ -200,7 +197,7 @@ class ExclusionConstraintError extends DatabaseError {
super(options.parent); super(options.parent);
this.name = 'SequelizeExclusionConstraintError'; this.name = 'SequelizeExclusionConstraintError';
this.message = options.message || options.parent.message; this.message = options.message || options.parent.message || '';
this.constraint = options.constraint; this.constraint = options.constraint;
this.fields = options.fields; this.fields = options.fields;
this.table = options.table; this.table = options.table;
...@@ -340,7 +337,6 @@ class InstanceError extends BaseError { ...@@ -340,7 +337,6 @@ class InstanceError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeInstanceError'; this.name = 'SequelizeInstanceError';
this.message = message;
Error.captureStackTrace(this, this.constructor); Error.captureStackTrace(this, this.constructor);
} }
} }
...@@ -353,7 +349,6 @@ class EmptyResultError extends BaseError { ...@@ -353,7 +349,6 @@ class EmptyResultError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeEmptyResultError'; this.name = 'SequelizeEmptyResultError';
this.message = message;
Error.captureStackTrace(this, this.constructor); Error.captureStackTrace(this, this.constructor);
} }
} }
...@@ -366,7 +361,6 @@ class EagerLoadingError extends BaseError { ...@@ -366,7 +361,6 @@ class EagerLoadingError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeEagerLoadingError'; this.name = 'SequelizeEagerLoadingError';
this.message = message;
Error.captureStackTrace(this, this.constructor); Error.captureStackTrace(this, this.constructor);
} }
} }
...@@ -379,7 +373,6 @@ class AssociationError extends BaseError { ...@@ -379,7 +373,6 @@ class AssociationError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeAssociationError'; this.name = 'SequelizeAssociationError';
this.message = message;
Error.captureStackTrace(this, this.constructor); Error.captureStackTrace(this, this.constructor);
} }
} }
...@@ -391,7 +384,6 @@ class QueryError extends BaseError { ...@@ -391,7 +384,6 @@ class QueryError extends BaseError {
constructor(message) { constructor(message) {
super(message); super(message);
this.name = 'SequelizeQueryError'; this.name = 'SequelizeQueryError';
this.message = message;
Error.captureStackTrace(this, this.constructor); 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!