Browse Source

* Stack trace support

git-svn-id: trunk@567 -
peter 20 years ago
parent
commit
0eadf16db9
1 changed files with 11 additions and 1 deletions
  1. 11 1
      fcl/inc/cgiapp.pp

+ 11 - 1
fcl/inc/cgiapp.pp

@@ -341,6 +341,9 @@ Procedure TCgiApplication.ShowException(E: Exception);
 
 
 Var
 Var
   TheEmail : String;
   TheEmail : String;
+  FrameCount: integer;
+  Frames: PPointer;
+  FrameNumber:Integer;
 
 
 begin
 begin
   If not FContentTypeEmitted then
   If not FContentTypeEmitted then
@@ -355,7 +358,14 @@ begin
     AddResponseLN('<center><hr><h1>'+Title+': ERROR</h1><hr></center><br><br>');
     AddResponseLN('<center><hr><h1>'+Title+': ERROR</h1><hr></center><br><br>');
     AddResponseLN(SAppEncounteredError+'<br>');
     AddResponseLN(SAppEncounteredError+'<br>');
     AddResponseLN('<ul>');
     AddResponseLN('<ul>');
-    AddResponseLN('<li>'+SError+' <b>'+E.Message+'</b></ul><hr>');
+    AddResponseLN('<li>'+SError+' <b>'+E.Message+'</b>');
+    AddResponseLn('<li> Stack trace:<br>');
+    AddResponseLn(BackTraceStrFunc(ExceptAddr)+'<br>');
+    FrameCount:=ExceptFrameCount;
+    Frames:=ExceptFrames;
+    for FrameNumber := 0 to FrameCount-1 do
+      AddResponseLn(BackTraceStrFunc(Frames[FrameNumber])+'<br>');
+    AddResponseLn('</ul><hr>');
     TheEmail:=Email;
     TheEmail:=Email;
     If (TheEmail<>'') then
     If (TheEmail<>'') then
       AddResponseLN('<h5><p><i>'+SNotify+Administrator+': <a href="mailto:'+TheEmail+'">'+TheEmail+'</a></i></p></h5>');
       AddResponseLN('<h5><p><i>'+SNotify+Administrator+': <a href="mailto:'+TheEmail+'">'+TheEmail+'</a></i></p></h5>');