ExcHook - an exception and stack trace logging unit for Delphi¹ applications.

& ParseRIP. - a Delphi IDE expert for inspecting ExcHook log files.

Version 1.00
Copyright © 1996 by Per B. Larsen


 

Overview

 
Exception handling is a very cool way of getting rid of the endless explicit tests for 
all the different error conditions that might occur during program execution. 
Routines that detect an error condition can simply raise an appropriate exception 
while the rest of the code for the most part can assume that nothing unusual 
happens. If the default approach doesn't quite cut it, the programmer can check 
for various specific error conditions, using except statements, and perform 
special action for those, while other, more generic exception types are passed on 
to the default handler.

This works quite well for the cases where the meaning of an exception is obvious 
- even out of context. Very often, however, this is not the case. There are a number 
of exception types that can occur for any number of reasons in a application.


For exceptions like "list index out of bounds", "file not found", "cannot focus a 
hidden or disabled window" etc, that can occur for a number of reasons at the 
higher level, we have the break on exception option in the IDE, which - along with 
the Call Stack window - will usually reveal why the error occured.

Unfortunately, a lot of exceptions do not occur in the development environment 
but while the application is being tested or even at client sites. The ExcHook unit 
presented here essentially does what the IDE option break on exception does for 
stand-alone applications. Well, almost: Rather than breaking execution when an 
exception is raised, ExcHook records a stack trace, and if the exception reaches 
the default handler (that is, it is not handled by a specific except statement), the 
exception text and the stack trace is logged to a text file (RIP). 

This file can be passed back to the developer, who can locate the program 
locations from the stack dump using the ParseRIP expert or by utilizing the 
Search/Find error functionality of the Delphi IDE.