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

Commit d923ff31 by Ruben Bridgewater

Add parent error messages

1 parent 00576687
Showing with 3 additions and 3 deletions
...@@ -138,7 +138,7 @@ util.inherits(error.TimeoutError, error.BaseError); ...@@ -138,7 +138,7 @@ util.inherits(error.TimeoutError, error.BaseError);
error.UniqueConstraintError = function (options) { error.UniqueConstraintError = function (options) {
options = options || {}; options = options || {};
options.parent = options.parent || { sql: '' }; options.parent = options.parent || { sql: '' };
options.message = options.message || 'Validation error'; options.message = options.message || options.parent.message || 'Validation Error';
options.errors = options.errors || {}; options.errors = options.errors || {};
error.ValidationError.call(this, options.message, options.errors); error.ValidationError.call(this, options.message, options.errors);
...@@ -161,7 +161,7 @@ error.ForeignKeyConstraintError = function (options) { ...@@ -161,7 +161,7 @@ error.ForeignKeyConstraintError = function (options) {
error.DatabaseError.call(this, options.parent); error.DatabaseError.call(this, options.parent);
this.name = 'SequelizeForeignKeyConstraintError'; this.name = 'SequelizeForeignKeyConstraintError';
this.message = options.message; this.message = options.message || options.parent.message || 'Database Error';
this.fields = options.fields; this.fields = options.fields;
this.table = options.table; this.table = options.table;
this.value = options.value; this.value = options.value;
...@@ -181,7 +181,7 @@ error.ExclusionConstraintError = function (options) { ...@@ -181,7 +181,7 @@ error.ExclusionConstraintError = function (options) {
error.DatabaseError.call(this, options.parent); error.DatabaseError.call(this, options.parent);
this.name = 'SequelizeExclusionConstraintError'; this.name = 'SequelizeExclusionConstraintError';
this.message = options.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;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!