|
![]() |
#1 |
Участник
|
Может вся эта конструкция вызывается внутри транзакции?
|
|
![]() |
#2 |
Сенбернар
|
АААААА !!!! Неееет !!!
Это было первое, на что я смотрел зачем-то. Нет. Точно )
__________________
Best Regards, Roman |
|
![]() |
#3 |
Участник
|
Походу вот в чем дело, система автоматом восстанавливает параметры по retry, вот описание: http://msdn.microsoft.com/en-us/library/aa849924.aspx
|
|
|
За это сообщение автора поблагодарили: Logger (3), demoded (1). |
![]() |
#4 |
Сенбернар
|
Цитата:
Сообщение от handy-comp
![]() Походу вот в чем дело, система автоматом восстанавливает параметры по retry, вот описание: http://msdn.microsoft.com/en-us/library/aa849924.aspx
"The persistent variables (that is, the database and the Infolog) are set back automatically by the throw that leads to the catch/retry." Только в моем-то случае - так : - throw (зафиксировали InfoLog в состоянии "до throw") - catch (в нем вывели в инфолог error(...)) - retry (ушли обратно в цикл).. То есть, как бы - некому испортить то сообщение, что выведено внутри catch.. Не понимаю (с)
__________________
Best Regards, Roman |
|
![]() |
#5 |
Участник
|
И все таки именно так было задумано поведение 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). |
![]() |
#6 |
Сенбернар
|
Цитата:
То есть, говоря простым языком, вызов retry очищает инфолог до состояния, предшествующего try. Написано.. индийским английским, кстати.. Ща обойдем ![]()
__________________
Best Regards, Roman Последний раз редактировалось RVS; 20.09.2013 в 01:30. |
|
|
За это сообщение автора поблагодарили: alex55 (1). |
![]() |
#7 |
Участник
|
Цитата:
Сообщение от RVS
![]() Прочел невнимательно. "Whenever you have a retry, all the transient variables must be set back to the value they had just before the try. The persistent variables (that is, the database and the Infolog) are set back automatically by the throw that leads to the catch/retry."
То есть, говоря простым языком, вызов retry очищает инфолог до состояния, предшествующего throw. Написано.. индийским английским, кстати.. Ща обойдем ![]() |
|