nested transactions
Hey, i got something like -> prisma.transaction(async prisma => {
test(1)
test(2)
})
test1(() => {
and here i got another prisma.transcation(async prisma => {
prisma stuff to do
})
test2(() => {
and here i got another prisma.transcation(async prisma => {
prisma stuff to do
})
})
if i throw an error in test1() everything is fine and both transactions are not done.
if i throw an error in test2(), my first transaction gets commited.
if i swap test1() and test2() and i throw the error still in test2() all works fine.
My Problem is - how can i rely on that? if the functions must be in the right order, so my transaction is rolled back i got no way to make this save. How to handle this`? i really dont want to try and catch and rollback all myself because then i need no transaction.
Any suggestions?
test(1)
test(2)
})
test1(() => {
and here i got another prisma.transcation(async prisma => {
prisma stuff to do
})
test2(() => {
and here i got another prisma.transcation(async prisma => {
prisma stuff to do
})
})
if i throw an error in test1() everything is fine and both transactions are not done.
if i throw an error in test2(), my first transaction gets commited.
if i swap test1() and test2() and i throw the error still in test2() all works fine.
My Problem is - how can i rely on that? if the functions must be in the right order, so my transaction is rolled back i got no way to make this save. How to handle this`? i really dont want to try and catch and rollback all myself because then i need no transaction.
Any suggestions?