File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ procedure HandleException(Req: THorseRequest; Res: THorseResponse; Next: TProc);
88
99implementation
1010
11- uses System.JSON;
11+ uses System.JSON, System.TypInfo ;
1212
1313procedure HandleException (Req: THorseRequest; Res: THorseResponse; Next: TProc);
1414var
@@ -24,6 +24,24 @@ procedure HandleException(Req: THorseRequest; Res: THorseResponse; Next: TProc);
2424 begin
2525 LJSON := TJSONObject.Create;
2626 LJSON.AddPair(' error' , E.Error);
27+
28+ if not E.Title.Trim.IsEmpty then
29+ begin
30+ LJSON.AddPair(' title' , E.Title);
31+ end ;
32+
33+ if not E.&Unit .Trim.IsEmpty then
34+ begin
35+ LJSON.AddPair(' unit' , E.&Unit );
36+ end ;
37+
38+ if E.Code <> 0 then
39+ begin
40+ LJSON.AddPair(' code' , TJSONNumber.Create(E.Code));
41+ end ;
42+
43+ LJSON.AddPair(' type' , GetEnumName(TypeInfo(TMessageType), Integer(E.&Type )));
44+
2745 Res.Send<TJSONObject>(LJSON).Status(E.Status);
2846 end ;
2947
You can’t perform that action at this time.
0 commit comments