Board index » delphi » Exception handling on the server

Exception handling on the server


2004-05-18 06:07:12 AM
delphi8
At the moment when an exception occurs on the server I pass back two
variables to my client - the error code and the message. I also want to pass
back the name of the procedure which caused the exception. Is this possible
other than using a string and setting the name in code?
Derek
 
 

Re:Exception handling on the server

derek wrote on Tue, 18 May 2004 10:07:12 +1200 ...
Quote
At the moment when an exception occurs on the server I pass back two
variables to my client - the error code and the message. I also want to pass
back the name of the procedure which caused the exception. Is this possible
other than using a string and setting the name in code?
Using DCOM?
If you look at the way TComObject implements SafeCallException it sets
up an IErrorInfo object. There are a couple of hooks into this process
that you could use or you could just override SafeCallException and do
the whole thing yourself.
You can use one of the exception tracking utilities around (We use the
JCL) to get the procedure where the exception occurred and add it to the
IErrorInfo object.
You then have to handle this on the client and extract the information
you want from the IErrorInfo object there.
Marc Rohloff
marc rohloff at bigfoot dot com
 

Re:Exception handling on the server

derek writes:
Quote
At the moment when an exception occurs on the server I pass back two
variables to my client - the error code and the message. I also want
to pass back the name of the procedure which caused the exception. Is
this possible other than using a string and setting the name in code?
One potential way is to compile with map info and TD32 debug
information. Then use the functions in JclDebug.pas
(www.delphi-jedi.org, Jedi Code Library) to unwind the stack and find
out where the exception was raised. You can also use commercial tools
like Exception Magic etc. to get call stack information.
This is definitely not for production code, of course.
--
Deepak Shenoy (TeamB)
Agni Software
www.agnisoft.com