Skip to content

Commit c77f3cf

Browse files
docs(ValidationError): fix.
1 parent bc8e965 commit c77f3cf

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/lib/validation-error.class.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export class ValidationError extends Error {
5151

5252
/**
5353
* A template of the error message guarded by a `string` type with the replaceable `[problem]` and `[fix]` words.
54+
* By default, it's set to `Problem: [problem] => Fix: [fix]`. It can be set directly or by the `setTemplate()` and `setMessage()` method.
5455
* The value is being checked against the existence of `[problem]` and `[fix]` words.
55-
* By default, it's set to `Problem: [problem] => Fix: [fix]`.
5656
*/
5757
static get template(): string {
5858
return ValidationError.#template;
@@ -66,7 +66,7 @@ export class ValidationError extends Error {
6666
//#region instance public properties.
6767
/**
6868
* A possible solution to the described `problem` of validation that is guarded by a `string` type.
69-
* By default, it's an empty `string`.
69+
* By default, it's an empty `string`. It can be set directly or by the `setTemplate()` and `setMessage()` method
7070
*/
7171
public get fix(): string {
7272
return this.#fix;
@@ -76,8 +76,8 @@ export class ValidationError extends Error {
7676
}
7777

7878
/**
79-
* A validation error message guarded by a `string` type that can be built with the `problem` and `fix` of `ValidationError` by the
80-
* `throw()` and `setMessage()` method.
79+
* A validation error message guarded by a `string` type that can be built from the `problem` and `fix` of `ValidationError` on the
80+
* `template`. It can be set directly or by the `throw()` or `setMessage()` method.
8181
*/
8282
public set message(value: string) {
8383
super.message = guard.string(value) ? value : super.message;
@@ -87,14 +87,13 @@ export class ValidationError extends Error {
8787
}
8888

8989
/**
90-
* Error name of a `string` type that is being thrown.
91-
* By default, it's `ValidationError`.
90+
* Error name of a `string` type that is being thrown. By default, it's `ValidationError`.
9291
*/
9392
public name = ValidationError.name;
9493

9594
/**
96-
* Description of a validation problem guarded by a `string` type.
97-
* By default, it's an empty `string`.
95+
* Description of a validation problem guarded by a `string` type. By default, it's an empty `string`.
96+
* It can be set directly or by the `setProblem()` and `setMessage()` method.
9897
*/
9998
public get problem(): string {
10099
return this.#problem;
@@ -107,7 +106,7 @@ export class ValidationError extends Error {
107106
//#region static public methods
108107
/**
109108
* Defines the validation error message of a `string` type from the provided `message` of the `ErrorMessage` interface.
110-
* @param message An object of an `ErrorMessage` interface to build the message of a `string` type. The value is checked against
109+
* @param message An object of an `ErrorMessage` interface to build a message of a `string` type. The value is checked against
111110
* the proper `object`.
112111
* @param callback An optional callback function of `ResultCallback` type to handle the check whether the provided message contains
113112
* required `problem` and `fix` properties.
@@ -171,7 +170,7 @@ export class ValidationError extends Error {
171170
/**
172171
* Creates a new instance with the message. If the provided `message` is an `object`, then its properties are assigned
173172
* to the instance.
174-
* @param message The message of a `string` type or of an `ErrorMessage` interface to throw with an `Error`.
173+
* @param message The message of a `string` type or of an `ErrorMessage` interface that is used to throw with an `Error`.
175174
* @param callback An optional function to handle the internal instance of `Callback`.
176175
* @angularpackage
177176
*/
@@ -246,8 +245,8 @@ export class ValidationError extends Error {
246245
}
247246

248247
/**
249-
* Sets description problem of a validation error.
250-
* @param problem Description of a problem of validation error guarded by a `string` type.
248+
* Sets description problem of a validation.
249+
* @param problem Description of validation problem guarded by a `string` type.
251250
* @param callback An optional callback function of `ResultCallback` type to handle the check whether the provided `problem` is a
252251
* `string`. By default, it uses an internal callback under the `'setProblem'` name, which can be initially set by the optional `callback`
253252
* parameter that gives access to the internal instance of `Callback`.
@@ -287,7 +286,8 @@ export class ValidationError extends Error {
287286
/**
288287
* Throws an error of `ValidationError` with the message built from the stored `fix`, `problem` and `template` or optionally from
289288
* the provided `message`.
290-
* @param message An optional
289+
* @param message An optional object of an `ErrorMessage` interface to build the message of a `string` type.
290+
* The value is checked against the proper object.
291291
* @angularpackage
292292
*/
293293
public throw(message?: string | ErrorMessage): void {

0 commit comments

Comments
 (0)