diff options
author | bala <balanatarajan@users.noreply.github.com> | 1999-03-28 19:26:19 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 1999-03-28 19:26:19 +0000 |
commit | 7d35a0aede9412332db865a193f8b354b80ae2e6 (patch) | |
tree | 9c3f804ecb0ba35001edcbb73459b688fcfbeee5 | |
parent | 36729fab82b892403f28412272d913d78b6a5eab (diff) | |
download | ATCD-7d35a0aede9412332db865a193f8b354b80ae2e6.tar.gz |
Added a new example
-rw-r--r-- | docs/exceptions.html | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/docs/exceptions.html b/docs/exceptions.html index cbccbb25c7c..596c78f4a06 100644 --- a/docs/exceptions.html +++ b/docs/exceptions.html @@ -299,6 +299,42 @@ macros discussed here. </pre> </p> + <li><p>You may want to make a different series of calls after you + encounter/catch an exception. Here is what we recommend. + + <pre> + ACE_TRY + { + // Calls that can raise an exception + some_call1 (arg1, arg2, ACE_TRY_ENV); + ACE_TRY_CHECK; + . + . + . + ACE_TRY_CHECK; + } + ACE_CATCH (CORBA_some_exception, ex) + { + // Caught an exception, so we need to make some other calls + // to continue.. + + ACE_TRY_EX (block1) // basically a label + { + some_other_call1 (arg1,.. , ACE_TRY_ENV); + ACE_TRY_CHECK_EX (block1); + } + ACE_CATCH (CORBA_some_other_exception, ex1) + { + // Handle the exception here.. + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); // Needed to catch uncaught exceptions + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + </pre> + </p> + <li><p>Be <em>VERY</em> wary of <code>ACE_CATCHALL</code>. It catches exceptions of any type. If your program depends on it, then, more often than not, there're something wrong with it. @@ -306,7 +342,7 @@ macros discussed here. </li> <li><p>Instead of depending on <code>ACE_CATCHALL</code>, use - <code>auto_prt</code> style mechanism to prevent memory leaks + <code>auto_ptr</code> style mechanism to prevent memory leaks from exceptions. </p> </li> |