Skip to content

Commit

Permalink
[httpserver] better exception control
Browse files Browse the repository at this point in the history
  • Loading branch information
exilon committed Oct 22, 2020
1 parent 1a8f02e commit 2c5c3b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Quick.HttpServer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -391,16 +391,16 @@ procedure THTTPServer.OnGetRequest(aContext: TIdContext; aRequestInfo: TIdHTTPRe
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
response.StatusCode := 500;
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
Expand Down

0 comments on commit 2c5c3b7

Please sign in to comment.