Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 57dfc730
authored
Oct 09, 2014
by
Victor Pontis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make regex parsing more lenient
1 parent
3cd0f893
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
lib/dialects/postgres/query.js
lib/dialects/postgres/query.js
View file @
57dfc73
...
...
@@ -253,16 +253,22 @@ module.exports = (function() {
});
case
'23505'
:
// there are multiple different formats of error messages for this error code
// let's make sure to check both that we know about
match
=
err
.
detail
.
match
(
/Key
\((
.*
?)\)
=
\((
.*
?)\)
already exists/
);
match
=
match
||
err
.
detail
.
match
(
/Key
\((
.*
?)\)
=
\((
.*
?)\)
is duplicated/
);
return
new
sequelizeErrors
.
UniqueConstraintError
({
fields
:
match
[
1
].
split
(
', '
),
value
:
match
[
2
].
split
(
', '
),
index
:
null
,
parent
:
err
});
// this regex should check at least two
match
=
err
.
detail
.
match
(
/Key
\((
.*
?)\)
=
\((
.*
?)\)
/
);
if
(
match
)
{
return
new
sequelizeErrors
.
UniqueConstraintError
({
fields
:
match
[
1
].
split
(
', '
),
value
:
match
[
2
].
split
(
', '
),
index
:
null
,
parent
:
err
});
}
else
{
return
new
sequelizeErrors
.
UniqueConstraintError
({
error
:
err
,
message
:
'Could not further parse error message.'
});
}
default
:
return
new
sequelizeErrors
.
DatabaseError
(
err
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment