Any way to peek at the exception currently being thrown?

kdevel kdevel at vogtner.de
Thu Jun 17 21:51:56 UTC 2021


On Thursday, 17 June 2021 at 20:59:06 UTC, Steven Schveighoffer 
wrote:

[...]

>> Why don't you make the COMMIT explicit (by implementing commit 
>> method) and let the destructor ROLLBACK the transactino 
>> unconditionally?
>
> Yeah, that's possible, but then I still have to do:
>
> auto txn = conn.beginTransaction;
> scope(success) txn.commit;
>
> In which the `commit` call only does something on the 
> outer-most txn.
>
> Not much better. And a bit awkward.

You have nested transactions txn1, ... txnN. Then there is a path 
thru the code having a line when all transactions are to be 
commited. Why don't you explicitly write

    tnxN.commit;
    :
    tnx1.commit;

or whatever the appropriate order is? Why do you hide the commit 
(side effect!) in a scope exit?




More information about the Digitalmars-d mailing list