You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (is.objectKey(message, ['fix', 'problem'], callback)) {
190
+
if (is.string(template)) {
191
+
returntemplate
192
+
.replace(`[fix]`, message.fix)
193
+
.replace(`[problem]`, message.problem);
194
+
}
189
195
}
190
196
return'';
191
197
}
192
198
```
193
199
194
200
**Parameters:**
195
201
196
-
| Name: type | Description |
197
-
| :---------------------- | :---------- |
198
-
|`message: ErrorMessage`| An [`object`][js-object] of the [`ErrorMessage`](#errormessage) interface to build a message of a [`string`][js-string] type. The value is checked against the proper [`object`][js-object]|
202
+
| Name: type | Description |
203
+
| :-------------------------- | :---------- |
204
+
|`message: ErrorMessage`| An [`object`][js-object] of the [`ErrorMessage`](#errormessage) interface to build a message of a [`string`][js-string] type. The value is checked against the proper [`object`][js-object]|
205
+
|`template: string`| A message template of a [`string`][js-string] type with replaceable `[problem]` and `[fix]` from the given `message`. The value is checked against a [`string`][js-string]. By default, it's set to `Problem: [problem] => Fix: [fix]`|
206
+
|`callback?: ResultCallback`| An optional callback function of [`ResultCallback`][package-type-resultcallback] type to handle the check whether the provided message contains required `problem` and `fix` properties |
199
207
200
208
**Returns:**
201
209
202
-
The **return value** is a message of a `string` type created from the provided `message` of [`ErrorMessage`](#errormessage) interface, or it's an empty `string` if the provided message object isn't proper.
210
+
The **return value** is a message of a `string` type created from the provided `message` of [`ErrorMessage`](#errormessage) interface, or it's an empty [`string`][js-string] if the provided message [`object`][js-object] isn't proper.
203
211
204
212
**Usage:**
205
213
@@ -209,6 +217,7 @@ import { ValidationError } from '@angular-package/core';
209
217
210
218
const fix ='There is no solution to the described problem.';
211
219
const problem ='The problem has no solution.';
220
+
212
221
/**
213
222
* Returns
214
223
* --------
@@ -227,9 +236,14 @@ Creates a new instance with the message. If the provided `message` is an [`objec
|`message: string \| ErrorMessage`| The message of a `string` type or of an [`ErrorMessage`](#errormessage) interface that is used to throw with an [`error`][js-error]|
255
+
|`message: string \| ErrorMessage`| The message of a [`string`][js-string] type or of an [`ErrorMessage`](#errormessage) interface that is used to throw with an [`error`][js-error]|
242
256
243
257
**Returns:**
244
258
@@ -276,14 +290,6 @@ interface ErrorMessage {
276
290
}
277
291
```
278
292
279
-
### ResultHandler
280
-
281
-
Function to handle the result of the [`ResultCallback`][package-type-resultcallback][`function`][js-function] before its result returns.
0 commit comments