Skip to content

Commit

Permalink
fix(errors): spurious Bluebird warnings
Browse files Browse the repository at this point in the history
The way Sequelize instantiates some of its Error subclasses
confuses Bluebird into thinking that Promises are rejected
with non-Error objects.

See petkaantonov/bluebird#990
  • Loading branch information
gabegorelick committed Oct 2, 2017
1 parent 8e4c213 commit d53d9ac
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class BaseError extends Error {
constructor(message) {
super(message);
this.name = 'SequelizeBaseError';
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
}
Expand Down Expand Up @@ -86,7 +85,6 @@ class OptimisticLockError extends BaseError {
options.message = options.message || 'Attempting to update a stale model instance: ' + options.modelName;
super(options);
this.name = 'SequelizeOptimisticLockError';
this.message = options.message;
/**
* The name of the model on which the update was attempted
* @type {string}
Expand Down Expand Up @@ -156,7 +154,6 @@ class UniqueConstraintError extends ValidationError {
super(options.message, options.errors);

this.name = 'SequelizeUniqueConstraintError';
this.message = options.message;
this.errors = options.errors;
this.fields = options.fields;
this.parent = options.parent;
Expand Down Expand Up @@ -200,7 +197,7 @@ class ExclusionConstraintError extends DatabaseError {
super(options.parent);
this.name = 'SequelizeExclusionConstraintError';

this.message = options.message || options.parent.message;
this.message = options.message || options.parent.message || '';
this.constraint = options.constraint;
this.fields = options.fields;
this.table = options.table;
Expand Down Expand Up @@ -340,7 +337,6 @@ class InstanceError extends BaseError {
constructor(message) {
super(message);
this.name = 'SequelizeInstanceError';
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
}
Expand All @@ -353,7 +349,6 @@ class EmptyResultError extends BaseError {
constructor(message) {
super(message);
this.name = 'SequelizeEmptyResultError';
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
}
Expand All @@ -366,7 +361,6 @@ class EagerLoadingError extends BaseError {
constructor(message) {
super(message);
this.name = 'SequelizeEagerLoadingError';
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
}
Expand All @@ -379,7 +373,6 @@ class AssociationError extends BaseError {
constructor(message) {
super(message);
this.name = 'SequelizeAssociationError';
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
}
Expand All @@ -391,7 +384,6 @@ class QueryError extends BaseError {
constructor(message) {
super(message);
this.name = 'SequelizeQueryError';
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
}
Expand Down

0 comments on commit d53d9ac

Please sign in to comment.