File tree Expand file tree Collapse file tree 1 file changed +1
-18
lines changed
Expand file tree Collapse file tree 1 file changed +1
-18
lines changed Original file line number Diff line number Diff line change @@ -42,24 +42,7 @@ procedure HandleException(Req: THorseRequest; Res: THorseResponse; Next: {$IF DE
4242 raise;
4343 on E: EHorseException do
4444 begin
45- LJSON := TJSONObject.Create;
46- LJSON.{ $IF DEFINED(FPC)} Add{ $ELSE} AddPair{ $ENDIF} (' error' , E.Error);
47- if not E.Title.Trim.IsEmpty then
48- begin
49- LJSON.{ $IF DEFINED(FPC)} Add{ $ELSE} AddPair{ $ENDIF} (' title' , E.Title);
50- end ;
51- if not E.&Unit .Trim.IsEmpty then
52- begin
53- LJSON.{ $IF DEFINED(FPC)} Add{ $ELSE} AddPair{ $ENDIF} (' unit' , E.&Unit );
54- end ;
55- if E.Code <> 0 then
56- begin
57- LJSON.{ $IF DEFINED(FPC)} Add{ $ELSE} AddPair{ $ENDIF} (' code' , { $IF DEFINED(FPC)} TJSONIntegerNumber{ $ELSE} TJSONNumber{ $ENDIF} .Create(E.Code));
58- end ;
59- if E.&Type <> TMessageType.Default then
60- begin
61- LJSON.{ $IF DEFINED(FPC)} Add{ $ELSE} AddPair{ $ENDIF} (' type' , GetEnumName(TypeInfo(TMessageType), Integer(E.&Type )));
62- end ;
45+ LJSON := TJSONObject.ParseJSONValue(E.ToJSON) as TJSONObject;
6346 SendError(Res, LJSON, Integer(E.Status));
6447 end ;
6548 on E: Exception do
You can’t perform that action at this time.
0 commit comments