generated from shgysk8zer0/npm-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.js
79 lines (66 loc) · 1.42 KB
/
errors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
export class AegisInputError extends Error {
#anchor;
constructor(message, { cause, anchor } = {}) {
super(message, { cause });
if (anchor instanceof Element) {
this.#anchor = anchor;
}
}
setValidityOn(internals) {
if (internals instanceof ElementInternals) {
internals.setValidity({ [this.type]: true }, this.message, this.#anchor);
} else {
throw new TypeError('internals must be an instance of `ElementInternals`.');
}
}
}
export class ValueMissingError extends AegisInputError {
get type() {
return 'valueMissing';
}
}
export class TypeMismatchError extends AegisInputError {
get type() {
return 'typeMissmatch';
}
}
export class PatternMismatchError extends AegisInputError {
get type() {
return 'patternMismatch';
}
}
export class TooLongError extends AegisInputError {
get type() {
return 'tooLong';
}
}
export class TooShortError extends AegisInputError {
get type() {
return 'tooShort';
}
}
export class RangeUnderflowError extends AegisInputError {
get type() {
return 'rangeUnderflow';
}
}
export class RangeOverflowError extends AegisInputError {
get type() {
return 'rangeOverflow';
}
}
export class StepMismatchError extends AegisInputError {
get type() {
return 'stepMismatch';
}
}
export class BadInputError extends AegisInputError {
get type() {
return 'badInput';
}
}
export class CustomError extends AegisInputError {
get type() {
return 'customError';
}
}