C2FO / patio

Idiomatic database toolkit

Home Page:http://c2fo.github.io/patio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Promise returned from transaction() not always resolved.

jordan-ayers opened this issue · comments

The transaction() method returns a promise that is only resolved in some error conditions. When the transaction is successfully completed or rolled back )due to a promise error within the callback), this promise is not resolved. (See __transaction, currently at line 592 of lib/database/query.js.)

Or am I missing something here? It seems that I'm getting successful callbacks on the transaction promise in some cases, but I can't see where any code has access to the promise to trigger that...

Ah. Many, many layers of 'throw'. I haven't found all the paths that make this work yet, but I suspect that's part of the success handling I wasn't seeing.

Sorry for the noise. (I was checking the code to supplement the documentation, but didn't dig deep enough on the throw handling.)