pg-mvc-service 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,22 +15,42 @@ class RequestType extends ReqResType_1.default {
15
15
  // エラー文言
16
16
  // エラーメッセージの変更はサブクラスで行ってください
17
17
  // *****************************************
18
- this.INVALID_PATH_PARAM_UUID_ERROR_MESSAGE = 'The {property} in the URL must be a UUID. ({value})';
19
- this.REQUIRED_ERROR_MESSAGE = '{property} is required.';
20
- this.UNNECESSARY_INPUT_ERROR_MESSAGE = "{property} is unnecessary input. ";
21
- this.INVALID_OBJECT_ERROR_MESSAGE = '{property} must be of type Object. ({value})';
22
- this.INVALID_ARRAY_ERROR_MESSAGE = '{property} must be of type Array. ({value})';
23
- this.INVALID_NUMBER_ERROR_MESSAGE = '{property} must be of type number. ({value})';
24
- this.INVALID_BOOL_ERROR_MESSAGE = '{property} must be of type bool or a string with true, false, or a number with 0, 1. ({value})';
25
- this.INVALID_STRING_ERROR_MESSAGE = '{property} must be of type string. ({value})';
26
- this.INVALID_UUID_ERROR_MESSAGE = '{property} must be a UUID. ({value})';
27
- this.INVALID_MAIL_ERROR_MESSAGE = '{property} must be an email. ({value})';
28
- this.INVALID_HTTPS_ERROR_MESSAGE = '{property} must be an https or http URL. ({value})';
29
- this.INVALID_DATE_ERROR_MESSAGE = '{property} must be a string in "YYYY-MM-DD" format and a valid date. ({value})';
30
- this.INVALID_TIME_ERROR_MESSAGE = '{property} must be a string in "hh:mi" format and a valid time. ({value})';
31
- this.INVALID_DATETIME_ERROR_MESSAGE = '{property} must be a string in "YYYY-MM-DD hh:mi:ss" or "YYYY-MM-DDThh:mi:ss" format and a valid date and time. ({value})';
32
- this.INVALID_BASE64_ERROR_MESSAGE = '{property} must be in Base64 format. ({value})';
33
- this.INVALID_ENUM_ERROR_MESSAGE = '{property} must be in {enums}. ({value})';
18
+ this.ERROR_MESSAGE_ENGLISH = {
19
+ REQUIRED: '{property} is required.',
20
+ UNNECESSARY: '{property} is unnecessary input. ',
21
+ INVALID_OBJECT: '{property} must be of type Object. ({value})',
22
+ INVALID_ARRAY: '{property} must be of type Array. ({value})',
23
+ INVALID_NUMBER: '{property} must be of type number. ({value})',
24
+ INVALID_BOOL: '{property} must be of type bool or a string with true, false, or a number with 0, 1. ({value})',
25
+ INVALID_STRING: '{property} must be of type string. ({value})',
26
+ INVALID_UUID: '{property} must be a UUID. ({value})',
27
+ INVALID_MAIL: '{property} must be an email. ({value})',
28
+ INVALID_HTTPS: '{property} must be an https or http URL. ({value})',
29
+ INVALID_DATE: '{property} must be a string in "YYYY-MM-DD" format and a valid date. ({value})',
30
+ INVALID_TIME: '{property} must be a string in "hh:mi" format and a valid time. ({value})',
31
+ INVALID_DATETIME: '{property} must be a string in "YYYY-MM-DD hh:mi:ss" or "YYYY-MM-DDThh:mi:ss" format and a valid date and time. ({value})',
32
+ INVALID_BASE64: '{property} must be in Base64 format. ({value})',
33
+ INVALID_ENUM: '{property} must be in {enums}. ({value})'
34
+ };
35
+ this.ERROR_MESSAGE_JAPAN = {
36
+ BODY_REQUIRED: 'リクエストボディが必要です。',
37
+ REQUIRED: '{property}は必須項目です。',
38
+ UNNECESSARY: '{property}は不要な入力です。',
39
+ INVALID_OBJECT: '{property}はオブジェクト型である必要があります。({value})',
40
+ INVALID_ARRAY: '{property}は配列型である必要があります。({value})',
41
+ INVALID_NUMBER: '{property}は数値型である必要があります。({value})',
42
+ INVALID_BOOL: '{property}は真偽値型、またはtrue、falseの文字列、または0、1の数値である必要があります。({value})',
43
+ INVALID_STRING: '{property}は文字列型である必要があります。({value})',
44
+ INVALID_UUID: '{property}はUUIDである必要があります。({value})',
45
+ INVALID_MAIL: '{property}はメールアドレスである必要があります。({value})',
46
+ INVALID_HTTPS: '{property}はhttpsまたはhttpのURLである必要があります。({value})',
47
+ INVALID_DATE: '{property}は"YYYY-MM-DD"形式の文字列で有効な日付である必要があります。({value})',
48
+ INVALID_TIME: '{property}は"hh:mi"形式の文字列で有効な時刻である必要があります。({value})',
49
+ INVALID_DATETIME: '{property}は"YYYY-MM-DD hh:mi:ss"または"YYYY-MM-DDThh:mi:ss"形式の文字列で有効な日時である必要があります。({value})',
50
+ INVALID_BASE64: '{property}はBase64形式である必要があります。({value})',
51
+ INVALID_ENUM: '{property}は{enums}のいずれかである必要があります。({value})'
52
+ };
53
+ this.ERROR_MESSAGE = process.env.TZ === 'Tokyo/Asia' ? this.ERROR_MESSAGE_JAPAN : this.ERROR_MESSAGE_ENGLISH;
34
54
  }
35
55
  get Params() {
36
56
  var _a;
@@ -64,15 +84,18 @@ class RequestType extends ReqResType_1.default {
64
84
  setRequest(request) {
65
85
  var _a, _b, _c;
66
86
  this.createBody(request);
67
- if (request.params !== undefined) {
68
- for (const [key, value] of Object.entries(request.params)) {
69
- if (key.includes("id") || key.includes("Id")) {
70
- if (this.isUUID(value) === false) {
71
- throw new Exception_1.InputErrorException("990", this.ErrorMessage("990", [key], value));
72
- }
73
- }
74
- }
75
- }
87
+ // todo: param設定、Requestと同じようにする
88
+ // Swaggerも自動作成できると良い
89
+ // Arrayでエンドポイントの順番決めるのがいいのか?
90
+ // if (request.params !== undefined) {
91
+ // for (const [key, value] of Object.entries(request.params)) {
92
+ // if (key.includes("id") || key.includes("Id")) {
93
+ // if (this.isUUID(value) === false) {
94
+ // throw new InputErrorException("990", this.ErrorMessage("990", [key], value));
95
+ // }
96
+ // }
97
+ // }
98
+ // }
76
99
  this.params = (_a = request.params) !== null && _a !== void 0 ? _a : {};
77
100
  this.headers = (_b = request.headers) !== null && _b !== void 0 ? _b : {};
78
101
  this.remoteAddress = (_c = request.socket) === null || _c === void 0 ? void 0 : _c.remoteAddress;
@@ -87,44 +110,42 @@ class RequestType extends ReqResType_1.default {
87
110
  */
88
111
  ErrorMessage(code, keys, value) {
89
112
  const list = {
90
- "990": this.INVALID_PATH_PARAM_UUID_ERROR_MESSAGE,
91
- "000": this.REQUIRED_ERROR_MESSAGE,
92
- "001": this.REQUIRED_ERROR_MESSAGE,
93
- "101": this.REQUIRED_ERROR_MESSAGE,
94
- "301": this.REQUIRED_ERROR_MESSAGE,
95
- "002": this.INVALID_OBJECT_ERROR_MESSAGE,
96
- "102": this.INVALID_OBJECT_ERROR_MESSAGE,
97
- "003": this.INVALID_ARRAY_ERROR_MESSAGE,
98
- "103": this.INVALID_ARRAY_ERROR_MESSAGE,
99
- "004": this.UNNECESSARY_INPUT_ERROR_MESSAGE,
100
- "104": this.UNNECESSARY_INPUT_ERROR_MESSAGE,
101
- "201": this.INVALID_NUMBER_ERROR_MESSAGE,
102
- "211": this.INVALID_BOOL_ERROR_MESSAGE,
103
- "212": this.INVALID_BOOL_ERROR_MESSAGE,
104
- "213": this.INVALID_BOOL_ERROR_MESSAGE,
105
- "221": this.INVALID_STRING_ERROR_MESSAGE,
106
- "231": this.INVALID_UUID_ERROR_MESSAGE,
107
- "241": this.INVALID_MAIL_ERROR_MESSAGE,
108
- "251": this.INVALID_DATE_ERROR_MESSAGE,
109
- "252": this.INVALID_DATE_ERROR_MESSAGE,
110
- "261": this.INVALID_TIME_ERROR_MESSAGE,
111
- "271": this.INVALID_DATETIME_ERROR_MESSAGE,
112
- "272": this.INVALID_DATETIME_ERROR_MESSAGE,
113
- "281": this.INVALID_HTTPS_ERROR_MESSAGE,
114
- "291": this.INVALID_BASE64_ERROR_MESSAGE,
115
- "411": this.INVALID_NUMBER_ERROR_MESSAGE,
116
- "421": this.INVALID_BOOL_ERROR_MESSAGE,
117
- "422": this.INVALID_BOOL_ERROR_MESSAGE,
118
- "423": this.INVALID_BOOL_ERROR_MESSAGE,
119
- "431": this.INVALID_STRING_ERROR_MESSAGE,
113
+ "000": this.ERROR_MESSAGE.REQUIRED,
114
+ "001": this.ERROR_MESSAGE.REQUIRED,
115
+ "101": this.ERROR_MESSAGE.REQUIRED,
116
+ "301": this.ERROR_MESSAGE.REQUIRED,
117
+ "002": this.ERROR_MESSAGE.INVALID_OBJECT,
118
+ "102": this.ERROR_MESSAGE.INVALID_OBJECT,
119
+ "003": this.ERROR_MESSAGE.INVALID_ARRAY,
120
+ "103": this.ERROR_MESSAGE.INVALID_ARRAY,
121
+ "004": this.ERROR_MESSAGE.UNNECESSARY,
122
+ "104": this.ERROR_MESSAGE.UNNECESSARY,
123
+ "201": this.ERROR_MESSAGE.INVALID_NUMBER,
124
+ "411": this.ERROR_MESSAGE.INVALID_NUMBER,
125
+ "211": this.ERROR_MESSAGE.INVALID_BOOL,
126
+ "212": this.ERROR_MESSAGE.INVALID_BOOL,
127
+ "213": this.ERROR_MESSAGE.INVALID_BOOL,
128
+ "421": this.ERROR_MESSAGE.INVALID_BOOL,
129
+ "422": this.ERROR_MESSAGE.INVALID_BOOL,
130
+ "423": this.ERROR_MESSAGE.INVALID_BOOL,
131
+ "221": this.ERROR_MESSAGE.INVALID_STRING,
132
+ "431": this.ERROR_MESSAGE.INVALID_STRING,
133
+ "231": this.ERROR_MESSAGE.INVALID_UUID,
134
+ "241": this.ERROR_MESSAGE.INVALID_MAIL,
135
+ "251": this.ERROR_MESSAGE.INVALID_DATE,
136
+ "252": this.ERROR_MESSAGE.INVALID_DATE,
137
+ "261": this.ERROR_MESSAGE.INVALID_TIME,
138
+ "271": this.ERROR_MESSAGE.INVALID_DATETIME,
139
+ "272": this.ERROR_MESSAGE.INVALID_DATETIME,
140
+ "281": this.ERROR_MESSAGE.INVALID_HTTPS,
141
+ "291": this.ERROR_MESSAGE.INVALID_BASE64,
142
+ "401": this.ERROR_MESSAGE.INVALID_ENUM,
143
+ "402": this.ERROR_MESSAGE.INVALID_ENUM,
120
144
  };
121
- let errorMessage = '';
145
+ let errorMessage = list[code];
122
146
  if (code === "401" || code === "402") {
123
147
  const property = this.getProperty(keys);
124
- errorMessage = this.INVALID_ENUM_ERROR_MESSAGE.replace('{enums}', Object.keys(property.enums).join(','));
125
- }
126
- else {
127
- errorMessage = list[code];
148
+ errorMessage = errorMessage.replace('{enums}', Object.keys(property.enums).join(','));
128
149
  }
129
150
  errorMessage = errorMessage.replace("{property}", keys.join('.')).replace("{value}", value);
130
151
  return errorMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
@@ -10,22 +10,42 @@ export class RequestType extends ReqResType {
10
10
  // エラー文言
11
11
  // エラーメッセージの変更はサブクラスで行ってください
12
12
  // *****************************************
13
- public readonly INVALID_PATH_PARAM_UUID_ERROR_MESSAGE = 'The {property} in the URL must be a UUID. ({value})';
14
- public readonly REQUIRED_ERROR_MESSAGE = '{property} is required.';
15
- public readonly UNNECESSARY_INPUT_ERROR_MESSAGE = "{property} is unnecessary input. ";
16
- public readonly INVALID_OBJECT_ERROR_MESSAGE = '{property} must be of type Object. ({value})';
17
- public readonly INVALID_ARRAY_ERROR_MESSAGE = '{property} must be of type Array. ({value})';
18
- public readonly INVALID_NUMBER_ERROR_MESSAGE = '{property} must be of type number. ({value})';
19
- public readonly INVALID_BOOL_ERROR_MESSAGE = '{property} must be of type bool or a string with true, false, or a number with 0, 1. ({value})';
20
- public readonly INVALID_STRING_ERROR_MESSAGE = '{property} must be of type string. ({value})';
21
- public readonly INVALID_UUID_ERROR_MESSAGE = '{property} must be a UUID. ({value})';
22
- public readonly INVALID_MAIL_ERROR_MESSAGE = '{property} must be an email. ({value})';
23
- public readonly INVALID_HTTPS_ERROR_MESSAGE = '{property} must be an https or http URL. ({value})';
24
- public readonly INVALID_DATE_ERROR_MESSAGE = '{property} must be a string in "YYYY-MM-DD" format and a valid date. ({value})';
25
- public readonly INVALID_TIME_ERROR_MESSAGE = '{property} must be a string in "hh:mi" format and a valid time. ({value})';
26
- public readonly INVALID_DATETIME_ERROR_MESSAGE = '{property} must be a string in "YYYY-MM-DD hh:mi:ss" or "YYYY-MM-DDThh:mi:ss" format and a valid date and time. ({value})';
27
- public readonly INVALID_BASE64_ERROR_MESSAGE = '{property} must be in Base64 format. ({value})';
28
- public readonly INVALID_ENUM_ERROR_MESSAGE = '{property} must be in {enums}. ({value})';
13
+ public readonly ERROR_MESSAGE_ENGLISH = {
14
+ REQUIRED: '{property} is required.',
15
+ UNNECESSARY: '{property} is unnecessary input. ',
16
+ INVALID_OBJECT: '{property} must be of type Object. ({value})',
17
+ INVALID_ARRAY: '{property} must be of type Array. ({value})',
18
+ INVALID_NUMBER: '{property} must be of type number. ({value})',
19
+ INVALID_BOOL: '{property} must be of type bool or a string with true, false, or a number with 0, 1. ({value})',
20
+ INVALID_STRING: '{property} must be of type string. ({value})',
21
+ INVALID_UUID: '{property} must be a UUID. ({value})',
22
+ INVALID_MAIL: '{property} must be an email. ({value})',
23
+ INVALID_HTTPS: '{property} must be an https or http URL. ({value})',
24
+ INVALID_DATE: '{property} must be a string in "YYYY-MM-DD" format and a valid date. ({value})',
25
+ INVALID_TIME: '{property} must be a string in "hh:mi" format and a valid time. ({value})',
26
+ INVALID_DATETIME: '{property} must be a string in "YYYY-MM-DD hh:mi:ss" or "YYYY-MM-DDThh:mi:ss" format and a valid date and time. ({value})',
27
+ INVALID_BASE64: '{property} must be in Base64 format. ({value})',
28
+ INVALID_ENUM: '{property} must be in {enums}. ({value})'
29
+ }
30
+ public readonly ERROR_MESSAGE_JAPAN = {
31
+ BODY_REQUIRED: 'リクエストボディが必要です。',
32
+ REQUIRED: '{property}は必須項目です。',
33
+ UNNECESSARY: '{property}は不要な入力です。',
34
+ INVALID_OBJECT: '{property}はオブジェクト型である必要があります。({value})',
35
+ INVALID_ARRAY: '{property}は配列型である必要があります。({value})',
36
+ INVALID_NUMBER: '{property}は数値型である必要があります。({value})',
37
+ INVALID_BOOL: '{property}は真偽値型、またはtrue、falseの文字列、または0、1の数値である必要があります。({value})',
38
+ INVALID_STRING: '{property}は文字列型である必要があります。({value})',
39
+ INVALID_UUID: '{property}はUUIDである必要があります。({value})',
40
+ INVALID_MAIL: '{property}はメールアドレスである必要があります。({value})',
41
+ INVALID_HTTPS: '{property}はhttpsまたはhttpのURLである必要があります。({value})',
42
+ INVALID_DATE: '{property}は"YYYY-MM-DD"形式の文字列で有効な日付である必要があります。({value})',
43
+ INVALID_TIME: '{property}は"hh:mi"形式の文字列で有効な時刻である必要があります。({value})',
44
+ INVALID_DATETIME: '{property}は"YYYY-MM-DD hh:mi:ss"または"YYYY-MM-DDThh:mi:ss"形式の文字列で有効な日時である必要があります。({value})',
45
+ INVALID_BASE64: '{property}はBase64形式である必要があります。({value})',
46
+ INVALID_ENUM: '{property}は{enums}のいずれかである必要があります。({value})'
47
+ }
48
+ public readonly ERROR_MESSAGE = process.env.TZ === 'Tokyo/Asia' ? this.ERROR_MESSAGE_JAPAN : this.ERROR_MESSAGE_ENGLISH;
29
49
 
30
50
  private params?: {[key: string]: any};
31
51
  get Params(): {[key: string]: any} {
@@ -60,15 +80,18 @@ export class RequestType extends ReqResType {
60
80
 
61
81
  public setRequest(request: Request) {
62
82
  this.createBody(request);
63
- if (request.params !== undefined) {
64
- for (const [key, value] of Object.entries(request.params)) {
65
- if (key.includes("id") || key.includes("Id")) {
66
- if (this.isUUID(value) === false) {
67
- throw new InputErrorException("990", this.ErrorMessage("990", [key], value));
68
- }
69
- }
70
- }
71
- }
83
+ // todo: param設定、Requestと同じようにする
84
+ // Swaggerも自動作成できると良い
85
+ // Arrayでエンドポイントの順番決めるのがいいのか?
86
+ // if (request.params !== undefined) {
87
+ // for (const [key, value] of Object.entries(request.params)) {
88
+ // if (key.includes("id") || key.includes("Id")) {
89
+ // if (this.isUUID(value) === false) {
90
+ // throw new InputErrorException("990", this.ErrorMessage("990", [key], value));
91
+ // }
92
+ // }
93
+ // }
94
+ // }
72
95
  this.params = request.params ?? {};
73
96
  this.headers = request.headers ?? {};
74
97
 
@@ -83,49 +106,49 @@ export class RequestType extends ReqResType {
83
106
  * @param {any} value - The value that caused the error. エラーを引き起こした値
84
107
  * @returns {string} The generated error message. 生成されたエラーメッセージ
85
108
  */
86
- private ErrorMessage(code: "990" | "000" | "001" | "002" | "003" | "004" | "101" | "102" | "103" | "104" |
109
+ private ErrorMessage(code: "000" | "001" | "002" | "003" | "004" | "101" | "102" | "103" | "104" |
87
110
  "201" | "211" | "212" | "213" | "221" | "231" | "241" | "251" | "252" |
88
111
  "261" | "271" | "272" | "281" | "291" | "301" | "401" | "402" | "411" | "421" | "422" | "423" | "431", keys: Array<string | number>, value: any): string {
89
112
  const list = {
90
- "990": this.INVALID_PATH_PARAM_UUID_ERROR_MESSAGE,
91
- "000": this.REQUIRED_ERROR_MESSAGE,
92
- "001": this.REQUIRED_ERROR_MESSAGE,
93
- "101": this.REQUIRED_ERROR_MESSAGE,
94
- "301": this.REQUIRED_ERROR_MESSAGE,
95
- "002": this.INVALID_OBJECT_ERROR_MESSAGE,
96
- "102": this.INVALID_OBJECT_ERROR_MESSAGE,
97
- "003": this.INVALID_ARRAY_ERROR_MESSAGE,
98
- "103": this.INVALID_ARRAY_ERROR_MESSAGE,
99
- "004": this.UNNECESSARY_INPUT_ERROR_MESSAGE,
100
- "104": this.UNNECESSARY_INPUT_ERROR_MESSAGE,
101
- "201": this.INVALID_NUMBER_ERROR_MESSAGE,
102
- "211": this.INVALID_BOOL_ERROR_MESSAGE,
103
- "212": this.INVALID_BOOL_ERROR_MESSAGE,
104
- "213": this.INVALID_BOOL_ERROR_MESSAGE,
105
- "221": this.INVALID_STRING_ERROR_MESSAGE,
106
- "231": this.INVALID_UUID_ERROR_MESSAGE,
107
- "241": this.INVALID_MAIL_ERROR_MESSAGE,
108
- "251": this.INVALID_DATE_ERROR_MESSAGE,
109
- "252": this.INVALID_DATE_ERROR_MESSAGE,
110
- "261": this.INVALID_TIME_ERROR_MESSAGE,
111
- "271": this.INVALID_DATETIME_ERROR_MESSAGE,
112
- "272": this.INVALID_DATETIME_ERROR_MESSAGE,
113
- "281": this.INVALID_HTTPS_ERROR_MESSAGE,
114
- "291": this.INVALID_BASE64_ERROR_MESSAGE,
115
- "411": this.INVALID_NUMBER_ERROR_MESSAGE,
116
- "421": this.INVALID_BOOL_ERROR_MESSAGE,
117
- "422": this.INVALID_BOOL_ERROR_MESSAGE,
118
- "423": this.INVALID_BOOL_ERROR_MESSAGE,
119
- "431": this.INVALID_STRING_ERROR_MESSAGE,
113
+ "000": this.ERROR_MESSAGE.REQUIRED,
114
+ "001": this.ERROR_MESSAGE.REQUIRED,
115
+ "101": this.ERROR_MESSAGE.REQUIRED,
116
+ "301": this.ERROR_MESSAGE.REQUIRED,
117
+ "002": this.ERROR_MESSAGE.INVALID_OBJECT,
118
+ "102": this.ERROR_MESSAGE.INVALID_OBJECT,
119
+ "003": this.ERROR_MESSAGE.INVALID_ARRAY,
120
+ "103": this.ERROR_MESSAGE.INVALID_ARRAY,
121
+ "004": this.ERROR_MESSAGE.UNNECESSARY,
122
+ "104": this.ERROR_MESSAGE.UNNECESSARY,
123
+ "201": this.ERROR_MESSAGE.INVALID_NUMBER,
124
+ "411": this.ERROR_MESSAGE.INVALID_NUMBER,
125
+ "211": this.ERROR_MESSAGE.INVALID_BOOL,
126
+ "212": this.ERROR_MESSAGE.INVALID_BOOL,
127
+ "213": this.ERROR_MESSAGE.INVALID_BOOL,
128
+ "421": this.ERROR_MESSAGE.INVALID_BOOL,
129
+ "422": this.ERROR_MESSAGE.INVALID_BOOL,
130
+ "423": this.ERROR_MESSAGE.INVALID_BOOL,
131
+ "221": this.ERROR_MESSAGE.INVALID_STRING,
132
+ "431": this.ERROR_MESSAGE.INVALID_STRING,
133
+ "231": this.ERROR_MESSAGE.INVALID_UUID,
134
+ "241": this.ERROR_MESSAGE.INVALID_MAIL,
135
+ "251": this.ERROR_MESSAGE.INVALID_DATE,
136
+ "252": this.ERROR_MESSAGE.INVALID_DATE,
137
+ "261": this.ERROR_MESSAGE.INVALID_TIME,
138
+ "271": this.ERROR_MESSAGE.INVALID_DATETIME,
139
+ "272": this.ERROR_MESSAGE.INVALID_DATETIME,
140
+ "281": this.ERROR_MESSAGE.INVALID_HTTPS,
141
+ "291": this.ERROR_MESSAGE.INVALID_BASE64,
142
+ "401": this.ERROR_MESSAGE.INVALID_ENUM,
143
+ "402": this.ERROR_MESSAGE.INVALID_ENUM,
120
144
  }
121
145
 
122
- let errorMessage = '';
146
+ let errorMessage = list[code];
123
147
  if (code === "401" || code === "402") {
124
148
  const property = this.getProperty(keys);
125
- errorMessage = this.INVALID_ENUM_ERROR_MESSAGE.replace('{enums}', Object.keys(property.enums).join(','));
126
- } else {
127
- errorMessage = list[code];
149
+ errorMessage = errorMessage.replace('{enums}', Object.keys(property.enums).join(','));
128
150
  }
151
+
129
152
  errorMessage = errorMessage.replace("{property}", keys.join('.')).replace("{value}", value)
130
153
  return errorMessage;
131
154
  }