Closed
Description
It would be useful to be able to check what state a transaction is in (or at least whether it is still usable or not). For example if I do something like
let tx = session.beginTransaction();
tx.run(...).then(result =>{
//dostuff
return tx.commit();
}).catch(err => {
return tx.rollback(); //How to tell if I need to do this
});
Then how to I tell if I need to rollback my transaction in the catch block - the error could have been caused by some code other than the run statement failing, so I can't assume the transaction has been rolled back. At the moment it seems like the only solution is to add an extra catch to the tx.rollback() call, but this seems a bit messy (and looks even more messy using async await).
Metadata
Metadata
Assignees
Labels
No labels