Board index » delphi » Generic error handler

Generic error handler

I have a Database app that will post records in various locations.
Though I can write exception handling routine in each module, I perfer
to have a centralized procedure for handling all the Database exceptions
inside my application.  Is there a method to do this?

The other thing is I would like to do is to get more user friendly error
message such as 'key violation in xxxxxx table' rather then simply a
'key violation error'.  Where can I get more information about the error
(e.g. table name, field name, record info, etc)?

Thanks in advance!

Rodney Chan

 

Re:Generic error handler


Quote
>The other thing is I would like to do is to get more user friendly error
>message such as 'key violation in xxxxxx table' rather then simply a
>'key violation error'.  Where can I get more information about the error
>(e.g. table name, field name, record info, etc)?

I do not believe that all the information you are looking for is available.
assuming you re using BDE a keyviolation will be produced as part of an
edbEngineError   the edbengineError has an errors property.  Errors is an array
of TdbErrors which has a message and errorcode property.
iterating through the errors and associated message is what you will need to do
to get all the available information from this error.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads