Is it possible to have a global exception hook?

Posted by Heinrich Ulbricht on Stack Overflow See other posts from Stack Overflow or by Heinrich Ulbricht
Published on 2010-04-13T10:25:01Z Indexed on 2010/04/13 10:42 UTC
Read the original article Hit count: 321

Filed under:
|

Hi,

my code is fairly well covered with exception handling (try..except). Some exceptions are not expected to happen and some exceptions happen fairly often, which is expected and ok. Now I want to add some automated tests for this code. It would be good to know how many exceptions happened during execution, so I can later see if the expected number was raised or anything unexpected happened. I don't want to clutter every exception handling block with debug code, so my question is:

Is there a way to install some kind of global exception handler which sits right before all other exception handling blocks? I am searching for a central place to log these exceptions.

Thanks for any suggestions!

(And if this matters: it is Delphi 2009)

© Stack Overflow or respective owner

Related posts about delphi

Related posts about exception-handling