@@ -48,8 +48,9 @@ TDataValidatorMessage = record
48
48
CodeName: string; // ERROR_PRODUCT_CREATOR
49
49
Uri: string; // http://help.developer.org/error_product_creator
50
50
Data: string; // Anything
51
+ StatusCode: string; // 400
51
52
52
- constructor Create(const ATitle: string; const AMessage: string; const ADescription: string; const ASolution: string; const ASource: string = ' ' ; const ACode: string = ' ' ; const ACodeName: string = ' ' ; const AUri: string = ' ' ; const AData: string = ' ' ); overload;
53
+ constructor Create(const ATitle: string; const AMessage: string; const ADescription: string; const ASolution: string; const ASource: string = ' ' ; const ACode: string = ' ' ; const ACodeName: string = ' ' ; const AUri: string = ' ' ; const AData: string = ' ' ; const AStatusCode: string = ' ' ); overload;
53
54
constructor Create(const AMessage: string; const ADescription: string = ' ' ); overload;
54
55
constructor Create(const AJSONObject: TJSONObject; const AOwner: Boolean = False); overload;
55
56
@@ -83,7 +84,7 @@ implementation
83
84
84
85
{ TDataValidatorMessage }
85
86
86
- constructor TDataValidatorMessage.Create(const ATitle: string; const AMessage: string; const ADescription: string; const ASolution: string; const ASource: string = ' ' ; const ACode: string = ' ' ; const ACodeName: string = ' ' ; const AUri: string = ' ' ; const AData: string = ' ' );
87
+ constructor TDataValidatorMessage.Create(const ATitle: string; const AMessage: string; const ADescription: string; const ASolution: string; const ASource: string = ' ' ; const ACode: string = ' ' ; const ACodeName: string = ' ' ; const AUri: string = ' ' ; const AData: string = ' ' ; const AStatusCode: string = ' ' );
87
88
begin
88
89
Self.Title := ATitle;
89
90
Self.Message := AMessage;
@@ -94,8 +95,8 @@ constructor TDataValidatorMessage.Create(const ATitle: string; const AMessage: s
94
95
Self.Code := ACode;
95
96
Self.CodeName := ACodeName;
96
97
Self.Uri := AUri;
97
-
98
98
Self.Data := AData;
99
+ Self.StatusCode := AStatusCode;
99
100
end ;
100
101
101
102
constructor TDataValidatorMessage.Create(const AMessage: string; const ADescription: string = ' ' );
@@ -119,6 +120,7 @@ constructor TDataValidatorMessage.Create(const AJSONObject: TJSONObject; const A
119
120
Self.CodeName := AJSONObject.GetValue<string>(' code_name' , Self.CodeName);
120
121
Self.Uri := AJSONObject.GetValue<string>(' uri' , Self.Uri);
121
122
Self.Data := AJSONObject.GetValue<string>(' data' , Self.Data);
123
+ Self.StatusCode := AJSONObject.GetValue<string>(' status_code' , Self.Data);
122
124
finally
123
125
if AOwner then
124
126
AJSONObject.Free;
@@ -158,6 +160,9 @@ function TDataValidatorMessage.ToJSONObject(const AIncludeAll: Boolean = True):
158
160
if not Self.Data.IsEmpty or AIncludeAll then
159
161
LJO.AddPair(' data' , Self.Data);
160
162
163
+ if not Self.StatusCode.IsEmpty or AIncludeAll then
164
+ LJO.AddPair(' status_code' , Self.StatusCode);
165
+
161
166
Result := LJO;
162
167
end ;
163
168
0 commit comments