File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ procedure SendError(ARes:THorseResponse; AJson: TJSONObject; AStatus: Integer);
3333procedure HandleException (Req: THorseRequest; Res: THorseResponse; Next: { $IF DEFINED(FPC)} TNextProc{ $ELSE} TProc{ $ENDIF} );
3434var
3535 LJSON: TJSONObject;
36+ LStatus: Integer;
3637begin
3738 try
3839 Next();
@@ -63,9 +64,12 @@ procedure HandleException(Req: THorseRequest; Res: THorseResponse; Next: {$IF DE
6364 end ;
6465 on E: Exception do
6566 begin
67+ LStatus := Res.Status;
68+ if LStatus < Integer(THTTPStatus.BadRequest) then
69+ LStatus := Integer(THTTPStatus.InternalServerError);
6670 LJSON := TJSONObject.Create;
6771 LJSON.{ $IF DEFINED(FPC)} Add{ $ELSE} AddPair{ $ENDIF} (' error' , E.Message);
68- SendError(Res, LJSON, Integer(THTTPStatus.InternalServerError) );
72+ SendError(Res, LJSON, LStatus );
6973 end ;
7074 end ;
7175end ;
You can’t perform that action at this time.
0 commit comments