Показать сообщение отдельно
Старый 20.09.2013, 00:47   #8  
handy-comp is offline
handy-comp
Участник
 
96 / 78 (3) ++++
Регистрация: 27.09.2012
И все таки именно так было задумано поведение Infolog при использовании retry , посмотрите sample 4 вот здесь: http://msdn.microsoft.com/en-us/library/aa893385.aspx
Приведу код примера прямо здесь:
X++:
static void TryCatchRetry4Job(Args _args)
{
/***
  Demonstration of 'retry'. The Infolog output is partially erased
by 'retry', but the Print window is fully displayed.
***/
    Exception excepnEnum;
    int nCounter = 0;
    ;
    try
    {
        info("        .");
        print("        .");
        info("In the 'try' block, [" + int2str(nCounter) + "]. (j4)");
        print("In the 'try' block, [" + int2str(nCounter) + "]. (j4)");
        pause;
        nCounter++;
        if (nCounter >= 3) // Prevent infinite loop.
        {
            info("---- Will now throw a warning, which is not caught.");
            print("---- Will now throw a warning, which is not caught.");
            pause;
            throw Global::warning("This warning will not be caught. [" + int2str(nCounter) + "]");
        }
        else
        {
            info("Did not throw a warning this loop. [" + int2str(nCounter) + "]");
            print("Did not throw a warning this loop. [" + int2str(nCounter) + "]");
        }
        excepnEnum = Global::error("This error message is written to the Infolog.");
        throw excepnEnum;
    }
    catch (Exception::Error)
    {
        info("Caught 'Exception::Error'.");
        print("Caught 'Exception::Error'.");
        retry;
    }
    info("End of job.");
    print("End of job.");
    pause;
/**********  Actual Infolog output
Message (04:33:56 pm)
        .
In the 'try' block, [2]. (j4)
---- Will now throw a warning, which is not caught.
This warning will not be caught. [3]
**********/
}

Последний раз редактировалось handy-comp; 20.09.2013 в 00:49.
За это сообщение автора поблагодарили: RVS (2).