Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing Error Handling Component

Status
Not open for further replies.

BobbaFet

Programmer
Feb 25, 2001
903
NL
Hey all,

Here's what I want to do:
I always get the same information from the error handling
procedures I make for my applications. So what I want to
do is make it into an component and be able to just drop
it on the form and be done with it. Now I've tried to see
how the ApplicationEvents component works and basically I
just don't get it (any good books that I can read on the
subject of building your own components btw?). I will also
need to be able to enter 3 strings (I like to put into my
error reports what procedure was executing while the error
occured, what section of the procedure it was in and some
miscellaneous stuff).

What I want to know is: How to do the above and some advice
on books that I could read on making your own components.

[bobafett] BobbaFet [bobafett]
Code:
if not Programming = 'Severe Migraine' then
                       ShowMessage('Eureka!');
 
when you say error handler, do you mean an Exception handler?

Regardless, if your handlers are non-visual, then you should be able to simply move your error handler to a new unit, and then add the unit to the form's Units declaration. It's hard to say without knowing exactly how and what you're handling.
 
I want to use the Application.OnException event to get when
an error occures. What I do with my error handling is this:

I write to a file the following information:
- Date and time
- Application name
- Application major version number
- Application minor version number
- Windows version
- Sender classname
- Error classname
- Error message
- In which procedure it occures
- In what section of the procedure it occures
- Miscelaneous stuff

(Hence I need to be able to enter stuff here at design
time).

After that is done I show the user a message like
"An error occured. The information has been written away to file X. Please send file X to Some@Addr.ess so it can
be addressed."

This is all done everytime a error occures. Of course there
is error handling bits that need to be customized for each
application individually but I get this info for every
error in every app, hence I would like to build it into
a component.

[bobafett] BobbaFet [bobafett]
Code:
if not Programming = 'Severe Migraine' then
                       ShowMessage('Eureka!');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top