Determine if an exception has been thrown

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralf Jansen

    #1

    Determine if an exception has been thrown

    For logging purposes i want to determine if the current executing code is
    running in an ~exceptionhandl ing context~. I need no details about the exception
    just if an exception has been thrown and hasn't been handled yet.

    Following code should make clear what i mean and where i need that info.

    try
    {
    try
    {
    throw new Exception();
    }
    finally
    {
    // here i want to know if an exception has been thrown
    }
    }
    catch(Exception e)
    {
    // doSomething
    throw;
    }


    If i put a breakpoint inside the finally block i can inspect the Exception in
    the debugger through the '$Exception' pseudo variable. Is it possible to get
    that also in code?

    Thanks

    --
    Ralf Jansen

    deepinvent Software GmbH - Viersen, Germany - http://www.deepinvent.com
    Central Email Archiving The Easy Way - http://www.mailstore.com


Working...