1

Iam able to find Exception message only, how can i get procedure name?

procedure Division;
var
  i,j : Real;
begin
try
 i:=0;
 I:=10/i;
except on E: Exception do
  begin
    AppendtextFile (E.Message,'Exceptions.txt')
   end;
end;
end;

Thanks in advance

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490

1 Answers1

2

Plain vanilla Delphi, as delivered by Embarcadero provides no way for you to obtain the currently executing procedure name. In any case, that's often not very useful, because your exception handler may be some way up the call stack.

More useful is the call stack that led to the exception. You can obtain that, but again not using plain vanilla Delphi. In order to get such information you need stack tracing code (tricky to do well), and a detailed map of your executable. There are a number tools that give offer such a service: madExcept, EurekaLog, JCL debug are the most commonly used. I can personally recommend the first of these, although they all do the job admirably.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490