Browse Source

[httpserver] better exception control

Exilon 4 years ago
parent
commit
2c5c3b76a6
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Quick.HttpServer.pas

+ 3 - 3
Quick.HttpServer.pas

@@ -391,7 +391,8 @@ begin
     on E : Exception do
     begin
       //get unexpected exception
-      if E.ClassType <> EControlledException then
+      if E.InheritsFrom(EControlledException) then response.ContentText := response.ContentText + '<BR>' + e.Message
+      else
       begin
         if response.StatusCode = 200 then
         begin
@@ -399,8 +400,7 @@ begin
           response.StatusText := 'Internal server error';
         end;
         response.ContentText := e.Message;
-      end
-      else response.ContentText := response.ContentText + '<BR>' + e.Message;
+      end;
     end;
   end;
   //check if need return error page