A,

> exception occured,
> apart exception message also displayed the unit name and a procedure name
> where exception happened.

As far as I know the only way to get this info is to do it the hard way (ie
there is no RTI that you can look at).... If anyone knows if there is RTI
for the current procedure then I would REALLY like to know. Perhaps you can
query the call stack in some way? Anyone know how to do that?

I normally do the following.... Adds more code but with templates it does
not add much time to doing a procedure and the payback is in the fact that
you know where the exception happened exactly.....

////////////////////////////////////////////////////////////////////////////
////
// PURPOSE:
const
     PROC_NAME = 'The ProcName';
     ERR_MSG = 'The Error Message';
begin
     try

     except
       on E : Exception do
          Handle_AppExceptions(UNIT_NAME, PROC_NAME, ERR_MSG, E.Message,
                               SystemSettings.ViewForComposite);
     end;
end;

I have a const of UNIT_NAME declared per unit and then my generic
Handle_AppExceptions basically does some string formatting and then displays
a customised error dialog. (The last paramater basically controls font size
as write apps that also run on composite monitors) I also set
Application.OnException to point to a procedure that basically supplies
'Unknown' for the Handle_AppExceptions params so that I know that it was an
unhandled exception...... HTH's

------------------------------------------------------------------------
--Donovan
Donovan J. Edye [www.edye.wattle.id.au]
Namadgi Systems, Delphi Developer
Web: www.namsys.com.au E-Mail: [EMAIL PROTECTED]
Voice: +61 2 6285-3460 Fax: +61 2 6285-3459
TVisualBasic = Class(None);
------------------------------------------------------------------------


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Alex Kouznetsov
> Sent: Friday, 26 November 1999 13:09
> To: Multiple recipients of list delphi
> Subject: [DUG]: Application exception handling
>
>
> I have recently seen a Delphi application which, when an
> exception occured,
> apart exception message also displayed the unit name and a procedure name
> where exception happened.
>
> Should I believe that application I have seen just uses deatailed "per
> procedure" exception handling.
> Or there is a run time information of this type available in
> Delphi so that
> a universal application-wide exception handler could be set up which would
> be able to display/log names of unit and procedure where
> exception happened.
>
> I have always been after something like that and remember that
> kind of stuff
> was possible in Clipper. I could not find this possibility in Delphi.
>
> Alex
>
>
> ------------------------------------------------------------------
> ---------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to