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

Commit 177c1653 by Matt Broadstone

catch mutliple unique constraint messages from driver

There are more than one error messages related to unique
constraints that we need to catch. This closes one more broken
test, in ancitipation of the crate table refactoring which closes
the other.
1 parent 99abdc3f
......@@ -474,8 +474,8 @@ module.exports = (function() {
uniqueConstraintMapping: {
code: 'EREQUEST',
map: function(str) {
// we're manually remvoving uniq_ here for a future capability of defining column names explicitly
var match = str.match(/Violation of UNIQUE KEY constraint '(.*)'. Cannot insert duplicate key in object '?(.*?)$/);
match = match || str.match(/Cannot insert duplicate key row in object .* with unique index '(.*)'/);
if (match === null || match.length < 2) {
return false;
}
......
......@@ -165,6 +165,7 @@ module.exports = (function() {
Query.prototype.formatError = function (err) {
var match;
match = err.message.match(/Violation of UNIQUE KEY constraint '(.*)'. Cannot insert duplicate key in object '?(.*?)$/);
match = match || err.message.match(/Cannot insert duplicate key row in object .* with unique index '(.*)'/);
if (match && match.length > 1) {
return new sequelizeErrors.UniqueConstraintError({
name: 'SequelizeUniqueConstraintError',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!