Skip to content

Commit cfce0aa

Browse files
Added message type validation
1 parent d3a2c04 commit cfce0aa

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Src/Horse.HandleException.pas

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
unit Horse.HandleException;
2+
23
{$IF DEFINED(FPC)}
34
{$MODE DELPHI}{$H+}
45
{$ENDIF}
6+
57
interface
68

79
uses
810
{$IF DEFINED(FPC)}
9-
SysUtils,
11+
SysUtils,
1012
{$ELSE}
11-
System.SysUtils,
13+
System.SysUtils,
1214
{$ENDIF}
1315
Horse, Horse.Commons;
1416

@@ -18,9 +20,9 @@ implementation
1820

1921
uses
2022
{$IF DEFINED(FPC)}
21-
fpjson, TypInfo;
23+
fpjson, TypInfo;
2224
{$ELSE}
23-
System.JSON, System.TypInfo;
25+
System.JSON, System.TypInfo;
2426
{$ENDIF}
2527

2628
procedure SendError(ARes:THorseResponse; AJson: TJSONObject; AStatus: Integer);
@@ -58,7 +60,7 @@ procedure HandleException(Req: THorseRequest; Res: THorseResponse; Next: {$IF DE
5860
LJSON.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('code', {$IF DEFINED(FPC)}TJSONIntegerNumber{$ELSE}TJSONNumber{$ENDIF}.Create(E.Code));
5961
end;
6062

61-
if E.&Type <> TMessageType.Error then
63+
if E.&Type <> TMessageType.Default then
6264
begin
6365
LJSON.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('type', GetEnumName(TypeInfo(TMessageType), Integer(E.&Type)));
6466
end;

0 commit comments

Comments
 (0)