Skip to content

If error occurred when transaction rollbacking #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
purejs opened this issue Oct 28, 2014 · 4 comments
Closed

If error occurred when transaction rollbacking #934

purejs opened this issue Oct 28, 2014 · 4 comments
Labels

Comments

@purejs
Copy link

purejs commented Oct 28, 2014

See your doc https://github.com/felixge/node-mysql#transactions
I'm wondering how can I catch the error of rollbacking.
Or can you promise there is no error anymore when rollbacking?

@dougwilson
Copy link
Member

The example doesn't show, yes, but everything provides an error, so you could get the error from the rollback itself using

connection.rollback(function(err) {
})

@purejs
Copy link
Author

purejs commented Oct 29, 2014

ok, btw, if the connection created from a pool, after the transaction is commited, should I call connection.release() to return this connection? or the commit method implicit the action of release?

@dougwilson
Copy link
Member

If you call pool.getConnection(function (err, conn) {}), you must always call conn.release() exactly once on the conn; there are no exceptions :) This makes the API easy to understand when you should call it: always :)

@purejs
Copy link
Author

purejs commented Oct 30, 2014

got it :)

@mysqljs mysqljs locked and limited conversation to collaborators Apr 29, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants