Показать сообщение отдельно
Старый 28.01.2011, 23:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
axzaptech: Exceptions Inside Transactions
Источник: http://axzaptech.wordpress.com/2011/...-transactions/
==============

When an exception is thrown inside a transaction, the transaction is automatically aborted (a ttsabort operation occurs). This applies both for exceptions thrown manually and for exceptions thrown by the system.

If an exception is thrown inside a ttsBegin/ttsCommit block, it will be caught by the first matching catchlist that is outside the transaction block. If there is a catch block within the ttsBegin/ttsCommit, it will be ignored


Example


Example  shows how an exception in a ttsBegin/ttsCommit block is caught by the first catchlist outside the block rather than by the catch within the ttsBegin/ttsCommit block. If you run this code, “outside tts” will be printed before an Infolog displays “Message”.


X++:
 try
 {
  ttsbegin;
  try
  {
  throw error();
  }
  catch
  {
  print not ;
  pause;
  }
  ttscommit;
 }
 catch
 {
  print outside ;
  pause;
 }
Source: http://msdn.microsoft.com/en-us/libr...85(AX.10).aspx





Источник: http://axzaptech.wordpress.com/2011/...-transactions/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.