<html> <head> <title>Global Functions in Namespace cppu in Sourcefile exc_hlp.hxx</title> <link rel="stylesheet" type="text/css" href="../../cpp.css"> </head> <body> <div id="adc-cppref"> <a name="_top_"> </a><table class="navimain" border="0" cellpadding="1" cellspacing="0"> <tr align="center" valign="top"> <td class="navimain"> <a href="../../index.html">Overview</a> </td> <td class="navimain"> <a href="index.html">Namespace</a> </td> <td class="navimainnone"> Class </td> <td class="navimain"> <a href="../../index-files/index-1.html">Index</a> </td> <td class="navimain"> <a href="../../help.html">Help</a> </td> </tr> </table> <table class="navisub" cellpadding="0" cellspacing="3"></table> <hr> <div class="title"><h2>Global Functions in Namespace cppu<br> in Sourcefile exc_hlp.hxx</h2> </div><hr> <dl class="member"> <dt class="member"><a name="getCaughtException-3995"> </a>getCaughtException</dt> <dd class="member"><dl> <dt class="simple">::com::sun::star::uno::<a href="../com/sun/star/uno/c-Any.html">Any</a> <strong>getCaughtException</strong>();</dt> <dd><table class="param-table"></table> </dd> </dl> <br> </dd> <dd class="member"><table class="flag-table" border="1" cellspacing="0"> <tr> <td width="12%" class="flagname">virtual</td> <td width="12%" class="flagname">abstract</td> <td width="12%" class="flagname">const</td> <td width="12%" class="flagname">volatile</td> <td width="12%" class="flagname">template</td> <td width="12%" class="flagname">static</td> <td width="12%" class="flagname">inline</td> <td width="12%" class="flagname">C-linkage</td> </tr> <tr> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> </tr> </table> <br> </dd> <dd class="member"><dl> <dt>Summary</dt> <dd>Use this function to get the dynamic type of a caught C++-UNO exception; completes the above function throwing exceptions generically. </dd> <dt>Description</dt> <dd>try { ... } catch (::com::sun::star::uno::RuntimeException &) { // you ought not handle RuntimeExceptions: throw; } catch (::com::sun::star::uno::Exception &) { ::com::sun::star::uno::Any caught( ::cppu::getCaughtException() ); ... } Restrictions: - use only for caught C++-UNO exceptions (UNOIDL defined) - only as first statement in a catch block! - don't do a C++ rethrow (throw;) after you have called this function - call getCaughtException() just once in your catch block! (function internally uses a C++ rethrow) </dd> <dt>Return</dt> <dd> caught UNO exception </dd> <dt class="attention">ATTENTION!</dt> <dd>Caution! This function is limited to the same C++ compiler runtime library. E.g. for MSVC, this means that the catch handler code (the one that calls getCaughtException()) needs to use the very same C++ runtime library, e.g. msvcrt.dll as cppuhelper, e.g. cppuhelper3MSC.dll and the bridge library, e.g. msci_uno.dll. This is the case if all of them are compiled with the same compiler version. Background: The msci_uno.dll gets a rethrown exception out of the internal msvcrt.dll thread local storage (tls). Thus you _must_ not use this function if your code needs to run in newer UDK versions without being recompiled, because those newer UDK (-> OOo versions) potentially use newer C++ runtime libraries which most often become incompatible! But this function ought to be usable for most OOo internal C++-UNO development, because the whole OOo code base is compiled using the same C++ compiler (and linking against one runtime library). </dd> </dl> </dd> </dl> <hr> <dl class="member"> <dt class="member"><a name="throwException-3994"> </a>throwException</dt> <dd class="member"><dl> <dt class="simple">void <strong>throwException</strong>(</dt> <dd><table class="param-table"> <tr> <td>const ::com::sun::star::uno::<a href="../com/sun/star/uno/c-Any.html">Any</a> & </td> <td> rExc )</td> </tr> <tr> <td/><td> throw( ::com::sun::star::uno::<a href="../../../../common/ref/com/sun/star/uno/Exception.html">Exception</a> );</td> </tr> </table> </dd> </dl> <br> </dd> <dd class="member"><table class="flag-table" border="1" cellspacing="0"> <tr> <td width="12%" class="flagname">virtual</td> <td width="12%" class="flagname">abstract</td> <td width="12%" class="flagname">const</td> <td width="12%" class="flagname">volatile</td> <td width="12%" class="flagname">template</td> <td width="12%" class="flagname">static</td> <td width="12%" class="flagname">inline</td> <td width="12%" class="flagname">C-linkage</td> </tr> <tr> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> <td class="flagno">NO</td> </tr> </table> <br> </dd> <dd class="member"><dl> <dt>Description</dt> <dd>This function throws the exception given by rExc. The given value has to be of typeclass EXCEPTION and must be dervived from or of type com.sun.star.uno.Exception. </dd> <dt>Parameters</dt> <dd><table border="0" width="100%" cellpadding="3" cellspacing="0" class="expl-table"> <tr> <td width="15%" style="vertical-align:top; font-weight:bold">rExc</td> <td><pre> exception to be thrown. </pre></td> </tr> </table> </dd> </dl> </dd> </dl> <hr> <a href="#_top_" class="objchapter">Top of Page</a><hr size="3"><p class="copyright" align="center">Copyright © 2008 Sun Microsystems, Inc.</p> </div> <!-- id="adc-cppref" --> </body> </html>