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 5bc2d11c
authored
Feb 24, 2015
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove transaction deprecation notice and check for thenable on return
1 parent
b621950a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
3 deletions
lib/sequelize.js
lib/sequelize.js
View file @
5bc2d11
...
@@ -1114,8 +1114,6 @@ module.exports = (function() {
...
@@ -1114,8 +1114,6 @@ module.exports = (function() {
,
ns
=
Sequelize
.
cls
;
,
ns
=
Sequelize
.
cls
;
if
(
autoCallback
)
{
if
(
autoCallback
)
{
deprecated
(
'Note: When passing a callback to a transaction a promise chain is expected in return, the transaction will be committed or rejected based on the promise chain returned to the callback.'
);
var
transactionResolver
=
function
(
resolve
,
reject
)
{
var
transactionResolver
=
function
(
resolve
,
reject
)
{
transaction
.
prepareEnvironment
().
then
(
function
()
{
transaction
.
prepareEnvironment
().
then
(
function
()
{
if
(
ns
)
{
if
(
ns
)
{
...
@@ -1123,7 +1121,7 @@ module.exports = (function() {
...
@@ -1123,7 +1121,7 @@ module.exports = (function() {
}
}
var
result
=
autoCallback
(
transaction
);
var
result
=
autoCallback
(
transaction
);
if
(
!
result
)
return
reject
(
new
Error
(
'You need to return a promise chain
to the sequelize.transaction() callback'
));
if
(
!
result
||
!
result
.
then
)
return
reject
(
new
Error
(
'You need to return a promise chain/thenable
to the sequelize.transaction() callback'
));
result
.
then
(
function
(
result
)
{
result
.
then
(
function
(
result
)
{
return
transaction
.
commit
().
then
(
function
()
{
return
transaction
.
commit
().
then
(
function
()
{
...
...
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