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

Commit f22db806 by Mick Hansen

unique violation errors should be error objects

1 parent 8fb79193
Showing with 2 additions and 2 deletions
...@@ -411,7 +411,7 @@ module.exports = (function() { ...@@ -411,7 +411,7 @@ module.exports = (function() {
fields = fields.filter(function(f) { return f !== self.Model.tableName; }) fields = fields.filter(function(f) { return f !== self.Model.tableName; })
Utils._.each(self.__options.uniqueKeys, function(value, key) { Utils._.each(self.__options.uniqueKeys, function(value, key) {
if (Utils._.isEqual(value.fields, fields) && !!value.msg) { if (Utils._.isEqual(value.fields, fields) && !!value.msg) {
err = value.msg err = new Error(value.msg)
} }
}) })
} }
......
...@@ -28,7 +28,7 @@ module.exports = (function() { ...@@ -28,7 +28,7 @@ module.exports = (function() {
if (err) { if (err) {
err.sql = sql err.sql = sql
this.emit('error', err, this.callee) this.emit('error', err)
} else { } else {
this.emit('success', this.formatResults(results)) this.emit('success', this.formatResults(results))
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!