Показать сообщение отдельно
Старый 14.02.2009, 00:46   #2  
alex55 is offline
alex55
MCTS
MCBMSS
 
224 / 145 (5) +++++
Регистрация: 13.02.2007
Адрес: Москва
Цитата:
This behavior is by design. Whenever an exception is thrown all transactions are rolled back (except for two special exceptions namely Exception::UpdateConflict and Exception::UpdateConflictNotRecovered, that do not roll back the active transactions).
Однако: Exception::UpdateConflictNotRecovered у меня откатывает транзакцию как и другие ошибки, в отличие от Exception::UpdateConflict:

Info Сообщение (00:41:37) rec count: 3
Info Сообщение (00:41:37) level 1 catched
Info Сообщение (00:41:37) level 1 completed
Info Сообщение (00:41:37) rec count: 0

X++:
static void Test_TTS_1(Args _args)
{
    Test_TTS_1 Test_TTS_1;
    ;
 
    delete_from Test_TTS_1;

    try
    {
        ttsbegin; //tts level 1

        try
        {
            ttsbegin; //tts level 2

            try
            {
                Test_TTS_1.insert();
                Test_TTS_1.insert();
                Test_TTS_1.insert();
                select count(recid) from Test_TTS_1;
                info("rec count: " + int2str(Test_TTS_1.RecId));

                //throw error("my exception");
                throw Exception::UpdateConflictNotRecovered;
                //throw Exception::UpdateConflict;
            }
            catch //implicit ttsabort
            {
                info("level 3 catched");
            }

            ttscommit;

            info("level 3 completed");
        }
        catch //implicit ttsabort
        {
            info("level 2 catched");
        }

        ttscommit;

        info("level 2 completed");
    }
    catch //implicit ttsabort
    {
        info("level 1 catched");
    }

    info("level 1 completed");

    select count(recid) from Test_TTS_1;

    info("rec count: " + int2str(Test_TTS_1.RecId));

}