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);
8
8
9
9
implementation
10
10
11
- uses System.JSON;
11
+ uses System.JSON, System.TypInfo ;
12
12
13
13
procedure HandleException (Req: THorseRequest; Res: THorseResponse; Next: TProc);
14
14
var
@@ -24,6 +24,24 @@ procedure HandleException(Req: THorseRequest; Res: THorseResponse; Next: TProc);
24
24
begin
25
25
LJSON := TJSONObject.Create;
26
26
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
+
27
45
Res.Send<TJSONObject>(LJSON).Status(E.Status);
28
46
end ;
29
47
You can’t perform that action at this time.
0 commit comments