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);
33
33
procedure HandleException (Req: THorseRequest; Res: THorseResponse; Next: { $IF DEFINED(FPC)} TNextProc{ $ELSE} TProc{ $ENDIF} );
34
34
var
35
35
LJSON: TJSONObject;
36
+ LStatus: Integer;
36
37
begin
37
38
try
38
39
Next();
@@ -63,9 +64,12 @@ procedure HandleException(Req: THorseRequest; Res: THorseResponse; Next: {$IF DE
63
64
end ;
64
65
on E: Exception do
65
66
begin
67
+ LStatus := Res.Status;
68
+ if LStatus < Integer(THTTPStatus.BadRequest) then
69
+ LStatus := Integer(THTTPStatus.InternalServerError);
66
70
LJSON := TJSONObject.Create;
67
71
LJSON.{ $IF DEFINED(FPC)} Add{ $ELSE} AddPair{ $ENDIF} (' error' , E.Message);
68
- SendError(Res, LJSON, Integer(THTTPStatus.InternalServerError) );
72
+ SendError(Res, LJSON, LStatus );
69
73
end ;
70
74
end ;
71
75
end ;
You can’t perform that action at this time.
0 commit comments