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 613401a5
authored
Sep 08, 2016
by
overlookmotel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor for readability
1 parent
a915f859
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
lib/sequelize.js
lib/sequelize.js
View file @
613401a
...
...
@@ -979,19 +979,18 @@ class Sequelize {
if
(
!
autoCallback
)
return
transaction
.
prepareEnvironment
().
return
(
transaction
);
// autoCallback provided
return
Sequelize
.
_clsRun
(()
=>
transaction
.
prepareEnvironment
().
then
(()
=>
autoCallback
(
transaction
)
).
tap
(()
=>
transaction
.
commit
()
).
catch
(
err
=>
// Rollback transaction if not already finished (commit, rollback, etc) and reject with original error
Promise
.
try
(()
=>
{
// Rollback (ignore any error in rollback)
return
Sequelize
.
_clsRun
(()
=>
{
return
transaction
.
prepareEnvironment
()
.
then
(()
=>
autoCallback
(
transaction
))
.
tap
(()
=>
transaction
.
commit
())
.
catch
(
err
=>
{
// Rollback transaction if not already finished (commit, rollback, etc)
// and reject with original error (ignore any error in rollback)
return
Promise
.
try
(()
=>
{
if
(
!
transaction
.
finished
)
return
transaction
.
rollback
().
catch
(
function
()
{});
}).
throw
(
err
)
)
);
}).
throw
(
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