@devp0nt/error0 1.0.0-next.5 → 1.0.0-next.51
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.
- package/dist/cjs/index.cjs +614 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +345 -414
- package/dist/cjs/plugins/cause.cjs +63 -0
- package/dist/cjs/plugins/cause.cjs.map +1 -0
- package/dist/cjs/plugins/cause.d.cts +15 -0
- package/dist/cjs/plugins/code.cjs +46 -0
- package/dist/cjs/plugins/code.cjs.map +1 -0
- package/dist/cjs/plugins/code.d.cts +8 -0
- package/dist/cjs/plugins/expected.cjs +67 -0
- package/dist/cjs/plugins/expected.cjs.map +1 -0
- package/dist/cjs/plugins/expected.d.cts +37 -0
- package/dist/cjs/plugins/message-merge.cjs +39 -0
- package/dist/cjs/plugins/message-merge.cjs.map +1 -0
- package/dist/cjs/plugins/message-merge.d.cts +8 -0
- package/dist/cjs/plugins/meta.cjs +78 -0
- package/dist/cjs/plugins/meta.cjs.map +1 -0
- package/dist/cjs/plugins/meta.d.cts +7 -0
- package/dist/cjs/plugins/stack-merge.cjs +42 -0
- package/dist/cjs/plugins/stack-merge.cjs.map +1 -0
- package/dist/cjs/plugins/stack-merge.d.cts +8 -0
- package/dist/cjs/plugins/status.cjs +60 -0
- package/dist/cjs/plugins/status.cjs.map +1 -0
- package/dist/cjs/plugins/status.d.cts +9 -0
- package/dist/cjs/plugins/tags.cjs +73 -0
- package/dist/cjs/plugins/tags.cjs.map +1 -0
- package/dist/cjs/plugins/tags.d.cts +12 -0
- package/dist/esm/index.d.ts +345 -414
- package/dist/esm/index.js +530 -341
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/plugins/cause.d.ts +15 -0
- package/dist/esm/plugins/cause.js +39 -0
- package/dist/esm/plugins/cause.js.map +1 -0
- package/dist/esm/plugins/code.d.ts +8 -0
- package/dist/esm/plugins/code.js +22 -0
- package/dist/esm/plugins/code.js.map +1 -0
- package/dist/esm/plugins/expected.d.ts +37 -0
- package/dist/esm/plugins/expected.js +43 -0
- package/dist/esm/plugins/expected.js.map +1 -0
- package/dist/esm/plugins/message-merge.d.ts +8 -0
- package/dist/esm/plugins/message-merge.js +15 -0
- package/dist/esm/plugins/message-merge.js.map +1 -0
- package/dist/esm/plugins/meta.d.ts +7 -0
- package/dist/esm/plugins/meta.js +54 -0
- package/dist/esm/plugins/meta.js.map +1 -0
- package/dist/esm/plugins/stack-merge.d.ts +8 -0
- package/dist/esm/plugins/stack-merge.js +18 -0
- package/dist/esm/plugins/stack-merge.js.map +1 -0
- package/dist/esm/plugins/status.d.ts +9 -0
- package/dist/esm/plugins/status.js +36 -0
- package/dist/esm/plugins/status.js.map +1 -0
- package/dist/esm/plugins/tags.d.ts +12 -0
- package/dist/esm/plugins/tags.js +49 -0
- package/dist/esm/plugins/tags.js.map +1 -0
- package/package.json +53 -23
- package/src/index.test.ts +696 -452
- package/src/index.ts +1178 -502
- package/src/plugins/cause.test.ts +106 -0
- package/src/plugins/cause.ts +45 -0
- package/src/plugins/code.test.ts +27 -0
- package/src/plugins/code.ts +20 -0
- package/src/plugins/expected.test.ts +66 -0
- package/src/plugins/expected.ts +48 -0
- package/src/plugins/message-merge.test.ts +32 -0
- package/src/plugins/message-merge.ts +19 -0
- package/src/plugins/meta.test.ts +32 -0
- package/src/plugins/meta.ts +59 -0
- package/src/plugins/stack-merge.test.ts +57 -0
- package/src/plugins/stack-merge.ts +20 -0
- package/src/plugins/status.test.ts +54 -0
- package/src/plugins/status.ts +35 -0
- package/src/plugins/tags.test.ts +74 -0
- package/src/plugins/tags.ts +51 -0
- package/dist/cjs/index.js +0 -435
- package/dist/cjs/index.js.map +0 -1
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,421 +1,352 @@
|
|
|
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
|
-
|
|
1
|
+
type IsUnknown<T> = unknown extends T ? ([T] extends [unknown] ? true : false) : false;
|
|
2
|
+
type NormalizeUnknownToUndefined<T> = IsUnknown<T> extends true ? undefined : T;
|
|
3
|
+
type IsOnlyUndefined<T> = [Exclude<T, undefined>] extends [never] ? true : false;
|
|
4
|
+
type InferFirstArg<TFn> = TFn extends (...args: infer TArgs) => unknown ? TArgs extends [infer TFirst, ...unknown[]] ? TFirst : undefined : undefined;
|
|
5
|
+
type InferPluginPropInput<TProp extends ErrorPluginPropOptions<any, any, any, any>> = TProp extends {
|
|
6
|
+
init: infer TInit;
|
|
7
|
+
} ? NormalizeUnknownToUndefined<InferFirstArg<TInit>> : undefined;
|
|
8
|
+
type ErrorPluginPropInit<TInputValue, TOutputValue> = ((input: TInputValue) => TOutputValue) | (() => TOutputValue);
|
|
9
|
+
type ErrorPluginPropSerializeOptions<TOutputValue, TError extends Error0, TResolveValue extends TOutputValue | undefined> = {
|
|
10
|
+
own: TOutputValue | undefined;
|
|
11
|
+
flow: Array<TOutputValue | undefined>;
|
|
12
|
+
resolved: TResolveValue;
|
|
13
|
+
error: TError;
|
|
14
|
+
isPublic: boolean;
|
|
15
|
+
};
|
|
16
|
+
type ErrorPluginPropSerialize<TOutputValue, TError extends Error0, TResolveValue extends TOutputValue | undefined> = ((options: ErrorPluginPropSerializeOptions<TOutputValue, TError, TResolveValue>) => unknown) | false;
|
|
17
|
+
type ErrorPluginPropDeserialize<TOutputValue> = ((options: {
|
|
18
|
+
value: unknown;
|
|
19
|
+
record: Record<string, unknown>;
|
|
20
|
+
}) => TOutputValue | undefined) | false;
|
|
21
|
+
type ErrorPluginPropOptionsResolveOptions<TOutputValue, TError extends Error0> = {
|
|
22
|
+
own: TOutputValue | undefined;
|
|
23
|
+
flow: Array<TOutputValue | undefined>;
|
|
24
|
+
error: TError;
|
|
25
|
+
};
|
|
26
|
+
type ErrorPluginPropOptionsBase<TOutputValue, TError extends Error0, TResolveValue extends TOutputValue | undefined> = {
|
|
27
|
+
resolve: (options: ErrorPluginPropOptionsResolveOptions<TOutputValue, TError>) => TResolveValue;
|
|
28
|
+
serialize: ErrorPluginPropSerialize<TOutputValue, TError, TResolveValue>;
|
|
29
|
+
deserialize: ErrorPluginPropDeserialize<TOutputValue>;
|
|
30
|
+
};
|
|
31
|
+
type ErrorPluginPropOptionsWithInit<TInputValue, TOutputValue, TError extends Error0, TResolveValue extends TOutputValue | undefined> = ErrorPluginPropOptionsBase<TOutputValue, TError, TResolveValue> & {
|
|
32
|
+
init: ErrorPluginPropInit<TInputValue, TOutputValue>;
|
|
33
|
+
};
|
|
34
|
+
type ErrorPluginPropOptionsWithoutInit<TOutputValue, TError extends Error0, TResolveValue extends TOutputValue | undefined> = ErrorPluginPropOptionsBase<TOutputValue, TError, TResolveValue> & {
|
|
35
|
+
init?: undefined;
|
|
36
|
+
};
|
|
37
|
+
type ErrorPluginPropOptions<TInputValue = undefined, TOutputValue = unknown, TError extends Error0 = Error0, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined> = ErrorPluginPropOptionsWithInit<TInputValue, TOutputValue, TError, TResolveValue> | ErrorPluginPropOptionsWithoutInit<TOutputValue, TError, TResolveValue>;
|
|
38
|
+
type ErrorPluginMethodFn<TOutputValue, TArgs extends unknown[] = unknown[], TError extends Error0 = Error0> = (error: TError, ...args: TArgs) => TOutputValue;
|
|
39
|
+
type ErrorPluginAnyMethodFn = (error: any, ...args: any[]) => any;
|
|
40
|
+
type ErrorPluginAdaptResult<TOutputProps extends Record<string, unknown>> = Partial<TOutputProps> | undefined;
|
|
41
|
+
type ErrorPluginAdaptFn<TError extends Error0 = Error0, TOutputProps extends Record<string, unknown> = Record<never, never>> = ((error: TError) => void) | ((error: TError) => ErrorPluginAdaptResult<TOutputProps>);
|
|
42
|
+
type ErrorPluginStackSerialize<TError extends Error0> = (options: {
|
|
43
|
+
value: string | undefined;
|
|
44
|
+
error: TError;
|
|
45
|
+
isPublic: boolean;
|
|
46
|
+
}) => unknown;
|
|
47
|
+
type ErrorPluginStack<TError extends Error0 = Error0> = {
|
|
48
|
+
serialize: ErrorPluginStackSerialize<TError>;
|
|
49
|
+
};
|
|
50
|
+
type ErrorPluginCauseSerialize<TError extends Error0> = (options: {
|
|
51
|
+
cause: unknown;
|
|
52
|
+
error: TError;
|
|
53
|
+
isPublic: boolean;
|
|
54
|
+
is: (cause: unknown) => boolean;
|
|
55
|
+
serialize: (cause: unknown) => Record<string, unknown>;
|
|
56
|
+
}) => unknown;
|
|
57
|
+
type ErrorPluginCauseDeserialize = (options: {
|
|
58
|
+
cause: unknown;
|
|
59
|
+
error: Record<string, unknown>;
|
|
60
|
+
isSerialized: (serializedCause: unknown) => boolean;
|
|
61
|
+
fromSerialized: (serializedCause: unknown) => Error0;
|
|
62
|
+
}) => unknown;
|
|
63
|
+
type ErrorPluginCause<TError extends Error0 = Error0> = {
|
|
64
|
+
serialize: ErrorPluginCauseSerialize<TError>;
|
|
65
|
+
deserialize: ErrorPluginCauseDeserialize;
|
|
66
|
+
};
|
|
67
|
+
type ErrorPluginMessageSerialize<TError extends Error0> = (options: {
|
|
68
|
+
value: string;
|
|
69
|
+
error: TError;
|
|
70
|
+
isPublic: boolean;
|
|
71
|
+
}) => unknown;
|
|
72
|
+
type ErrorPluginMessage<TError extends Error0 = Error0> = {
|
|
73
|
+
serialize: ErrorPluginMessageSerialize<TError>;
|
|
74
|
+
};
|
|
75
|
+
type ErrorMethodRecord = {
|
|
76
|
+
fn: ErrorPluginAnyMethodFn;
|
|
77
|
+
};
|
|
78
|
+
type ErrorPluginProps = {
|
|
79
|
+
[key: string]: ErrorPluginPropOptions<any, any>;
|
|
80
|
+
};
|
|
81
|
+
type ErrorPluginMethods = {
|
|
82
|
+
[key: string]: ErrorPluginAnyMethodFn;
|
|
83
|
+
};
|
|
84
|
+
type ErrorPlugin<TProps extends ErrorPluginProps = Record<never, never>, TMethods extends ErrorPluginMethods = Record<never, never>> = {
|
|
85
|
+
props?: TProps;
|
|
86
|
+
methods?: TMethods;
|
|
87
|
+
adapt?: Array<ErrorPluginAdaptFn<Error0, PluginOutputProps<TProps>>>;
|
|
88
|
+
stack?: ErrorPluginStack;
|
|
89
|
+
cause?: ErrorPluginCause;
|
|
90
|
+
message?: ErrorPluginMessage;
|
|
91
|
+
};
|
|
92
|
+
type AddPropToPluginProps<TProps extends ErrorPluginProps, TKey extends string, TInputValue, TOutputValue, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined> = TProps & Record<TKey, ErrorPluginPropOptions<TInputValue, TOutputValue, Error0, TResolveValue>>;
|
|
93
|
+
type AddMethodToPluginMethods<TMethods extends ErrorPluginMethods, TKey extends string, TMethod extends ErrorPluginAnyMethodFn> = TMethods & Record<TKey, TMethod>;
|
|
94
|
+
type PluginOutputProps<TProps extends ErrorPluginProps> = {
|
|
95
|
+
[TKey in keyof TProps]: TProps[TKey] extends ErrorPluginPropOptions<any, any, any, infer TResolveValue> ? TResolveValue : never;
|
|
96
|
+
};
|
|
97
|
+
type ErrorPluginsMap = {
|
|
98
|
+
props: Record<string, {
|
|
99
|
+
init: unknown;
|
|
100
|
+
output: unknown;
|
|
101
|
+
resolve: unknown;
|
|
102
|
+
}>;
|
|
103
|
+
methods: Record<string, ErrorMethodRecord>;
|
|
104
|
+
};
|
|
105
|
+
type IsEmptyObject<T> = keyof T extends never ? true : false;
|
|
106
|
+
type ErrorInputBase = {
|
|
107
|
+
cause?: unknown;
|
|
108
|
+
};
|
|
109
|
+
type ErrorInputPluginProps<TPluginsMap extends ErrorPluginsMap> = {
|
|
110
|
+
[TKey in keyof TPluginsMap['props'] as IsOnlyUndefined<TPluginsMap['props'][TKey]['init']> extends true ? never : TKey]?: TPluginsMap['props'][TKey]['init'];
|
|
111
|
+
};
|
|
112
|
+
type ErrorInput<TPluginsMap extends ErrorPluginsMap> = IsEmptyObject<TPluginsMap['props']> extends true ? ErrorInputBase : ErrorInputBase & ErrorInputPluginProps<TPluginsMap>;
|
|
113
|
+
type ErrorResolvedProps<TPluginsMap extends ErrorPluginsMap> = {
|
|
114
|
+
[TKey in keyof TPluginsMap['props']]: TPluginsMap['props'][TKey]['resolve'];
|
|
115
|
+
};
|
|
116
|
+
type ErrorOwnProps<TPluginsMap extends ErrorPluginsMap> = {
|
|
117
|
+
[TKey in keyof TPluginsMap['props']]: TPluginsMap['props'][TKey]['output'] | undefined;
|
|
118
|
+
};
|
|
119
|
+
type ErrorOwnMethods<TPluginsMap extends ErrorPluginsMap> = {
|
|
120
|
+
own: {
|
|
121
|
+
(): ErrorOwnProps<TPluginsMap>;
|
|
122
|
+
<TKey extends keyof TPluginsMap['props'] & string>(key: TKey): ErrorOwnProps<TPluginsMap>[TKey];
|
|
123
|
+
};
|
|
124
|
+
flow: <TKey extends keyof TPluginsMap['props'] & string>(key: TKey) => Array<ErrorOwnProps<TPluginsMap>[TKey]>;
|
|
125
|
+
};
|
|
126
|
+
type ErrorResolveMethods<TPluginsMap extends ErrorPluginsMap> = {
|
|
127
|
+
resolve: () => ErrorResolvedProps<TPluginsMap>;
|
|
128
|
+
};
|
|
129
|
+
type BindInstanceMethod<TMethod> = TMethod extends {
|
|
130
|
+
(error: any, ...args: infer TArgs1): infer TOutput1;
|
|
131
|
+
(error: any, ...args: infer TArgs2): infer TOutput2;
|
|
132
|
+
(error: any, ...args: infer TArgs3): infer TOutput3;
|
|
133
|
+
(error: any, ...args: infer TArgs4): infer TOutput4;
|
|
134
|
+
} ? {
|
|
135
|
+
(...args: TArgs1): TOutput1;
|
|
136
|
+
(...args: TArgs2): TOutput2;
|
|
137
|
+
(...args: TArgs3): TOutput3;
|
|
138
|
+
(...args: TArgs4): TOutput4;
|
|
139
|
+
} : TMethod extends {
|
|
140
|
+
(error: any, ...args: infer TArgs1): infer TOutput1;
|
|
141
|
+
(error: any, ...args: infer TArgs2): infer TOutput2;
|
|
142
|
+
(error: any, ...args: infer TArgs3): infer TOutput3;
|
|
143
|
+
} ? {
|
|
144
|
+
(...args: TArgs1): TOutput1;
|
|
145
|
+
(...args: TArgs2): TOutput2;
|
|
146
|
+
(...args: TArgs3): TOutput3;
|
|
147
|
+
} : TMethod extends {
|
|
148
|
+
(error: any, ...args: infer TArgs1): infer TOutput1;
|
|
149
|
+
(error: any, ...args: infer TArgs2): infer TOutput2;
|
|
150
|
+
} ? {
|
|
151
|
+
(...args: TArgs1): TOutput1;
|
|
152
|
+
(...args: TArgs2): TOutput2;
|
|
153
|
+
} : TMethod extends (error: any, ...args: infer TArgs) => infer TOutput ? (...args: TArgs) => TOutput : never;
|
|
154
|
+
type BindStaticMethod<TMethod> = TMethod extends {
|
|
155
|
+
(error: any, ...args: infer TArgs1): infer TOutput1;
|
|
156
|
+
(error: any, ...args: infer TArgs2): infer TOutput2;
|
|
157
|
+
(error: any, ...args: infer TArgs3): infer TOutput3;
|
|
158
|
+
(error: any, ...args: infer TArgs4): infer TOutput4;
|
|
159
|
+
} ? {
|
|
160
|
+
(error: unknown, ...args: TArgs1): TOutput1;
|
|
161
|
+
(error: unknown, ...args: TArgs2): TOutput2;
|
|
162
|
+
(error: unknown, ...args: TArgs3): TOutput3;
|
|
163
|
+
(error: unknown, ...args: TArgs4): TOutput4;
|
|
164
|
+
} : TMethod extends {
|
|
165
|
+
(error: any, ...args: infer TArgs1): infer TOutput1;
|
|
166
|
+
(error: any, ...args: infer TArgs2): infer TOutput2;
|
|
167
|
+
(error: any, ...args: infer TArgs3): infer TOutput3;
|
|
168
|
+
} ? {
|
|
169
|
+
(error: unknown, ...args: TArgs1): TOutput1;
|
|
170
|
+
(error: unknown, ...args: TArgs2): TOutput2;
|
|
171
|
+
(error: unknown, ...args: TArgs3): TOutput3;
|
|
172
|
+
} : TMethod extends {
|
|
173
|
+
(error: any, ...args: infer TArgs1): infer TOutput1;
|
|
174
|
+
(error: any, ...args: infer TArgs2): infer TOutput2;
|
|
175
|
+
} ? {
|
|
176
|
+
(error: unknown, ...args: TArgs1): TOutput1;
|
|
177
|
+
(error: unknown, ...args: TArgs2): TOutput2;
|
|
178
|
+
} : TMethod extends (error: any, ...args: infer TArgs) => infer TOutput ? (error: unknown, ...args: TArgs) => TOutput : never;
|
|
179
|
+
type ErrorMethods<TPluginsMap extends ErrorPluginsMap> = {
|
|
180
|
+
[TKey in keyof TPluginsMap['methods']]: BindInstanceMethod<TPluginsMap['methods'][TKey]['fn']>;
|
|
181
|
+
};
|
|
182
|
+
type ErrorResolved<TPluginsMap extends ErrorPluginsMap> = ErrorResolvedProps<TPluginsMap> & ErrorMethods<TPluginsMap>;
|
|
183
|
+
type ErrorStaticMethods<TPluginsMap extends ErrorPluginsMap> = {
|
|
184
|
+
[TKey in keyof TPluginsMap['methods']]: BindStaticMethod<TPluginsMap['methods'][TKey]['fn']>;
|
|
185
|
+
};
|
|
186
|
+
type EmptyPluginsMap = {
|
|
187
|
+
props: Record<never, {
|
|
188
|
+
init: never;
|
|
189
|
+
output: never;
|
|
190
|
+
resolve: never;
|
|
191
|
+
}>;
|
|
192
|
+
methods: Record<never, ErrorMethodRecord>;
|
|
193
|
+
};
|
|
194
|
+
type ErrorPluginResolved = {
|
|
195
|
+
props: Record<string, ErrorPluginPropOptions<unknown>>;
|
|
196
|
+
methods: Record<string, ErrorPluginMethodFn<unknown>>;
|
|
197
|
+
adapt: Array<ErrorPluginAdaptFn<Error0, Record<string, unknown>>>;
|
|
198
|
+
stack?: ErrorPluginStack;
|
|
199
|
+
cause?: ErrorPluginCause;
|
|
200
|
+
message?: ErrorPluginMessage;
|
|
201
|
+
propKeys: string[];
|
|
202
|
+
propEntries: Array<[string, ErrorPluginPropOptions<unknown>]>;
|
|
203
|
+
methodEntries: Array<[string, ErrorPluginMethodFn<unknown>]>;
|
|
204
|
+
};
|
|
205
|
+
type PluginPropsMapOf<TPlugin extends ErrorPlugin> = {
|
|
206
|
+
[TKey in keyof NonNullable<TPlugin['props']>]: NonNullable<TPlugin['props']>[TKey] extends ErrorPluginPropOptions<any, infer TOutputValue, any, infer TResolveValue> ? {
|
|
207
|
+
init: InferPluginPropInput<NonNullable<TPlugin['props']>[TKey]>;
|
|
208
|
+
output: TOutputValue;
|
|
209
|
+
resolve: TResolveValue;
|
|
210
|
+
} : never;
|
|
211
|
+
};
|
|
212
|
+
type PluginMethodsMapOf<TPlugin extends ErrorPlugin> = {
|
|
213
|
+
[TKey in keyof NonNullable<TPlugin['methods']>]: {
|
|
214
|
+
fn: NonNullable<TPlugin['methods']>[TKey] extends ErrorPluginAnyMethodFn ? NonNullable<TPlugin['methods']>[TKey] : never;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
type ErrorPluginsMapOfPlugin<TPlugin extends ErrorPlugin> = {
|
|
218
|
+
props: PluginPropsMapOf<TPlugin>;
|
|
219
|
+
methods: PluginMethodsMapOf<TPlugin>;
|
|
220
|
+
};
|
|
221
|
+
type ExtendErrorPluginsMap<TMap extends ErrorPluginsMap, TPlugin extends ErrorPlugin> = {
|
|
222
|
+
props: TMap['props'] & ErrorPluginsMapOfPlugin<TPlugin>['props'];
|
|
223
|
+
methods: TMap['methods'] & ErrorPluginsMapOfPlugin<TPlugin>['methods'];
|
|
224
|
+
};
|
|
225
|
+
type ExtendErrorPluginsMapWithProp<TMap extends ErrorPluginsMap, TKey extends string, TInputValue, TOutputValue, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined> = ExtendErrorPluginsMap<TMap, ErrorPlugin<Record<TKey, ErrorPluginPropOptions<TInputValue, TOutputValue, Error0, TResolveValue>>>>;
|
|
226
|
+
type ExtendErrorPluginsMapWithMethod<TMap extends ErrorPluginsMap, TKey extends string, TMethod extends ErrorPluginAnyMethodFn> = ExtendErrorPluginsMap<TMap, ErrorPlugin<Record<never, never>, Record<TKey, TMethod>>>;
|
|
227
|
+
type PluginsMapOf<TClass> = TClass extends {
|
|
228
|
+
__pluginsMap?: infer TPluginsMap;
|
|
229
|
+
} ? TPluginsMap extends ErrorPluginsMap ? TPluginsMap : EmptyPluginsMap : EmptyPluginsMap;
|
|
230
|
+
type PluginsMapOfInstance<TInstance> = TInstance extends {
|
|
231
|
+
__pluginsMap?: infer TPluginsMap;
|
|
232
|
+
} ? TPluginsMap extends ErrorPluginsMap ? TPluginsMap : EmptyPluginsMap : EmptyPluginsMap;
|
|
233
|
+
type PluginsMapFromParts<TProps extends ErrorPluginProps, TMethods extends ErrorPluginMethods> = ErrorPluginsMapOfPlugin<ErrorPlugin<TProps, TMethods>>;
|
|
234
|
+
type ErrorInstanceOfMap<TMap extends ErrorPluginsMap> = Error0 & ErrorResolved<TMap> & ErrorOwnMethods<TMap> & ErrorResolveMethods<TMap> & {
|
|
235
|
+
readonly __pluginsMap?: TMap;
|
|
236
|
+
};
|
|
237
|
+
type BuilderError0<TProps extends ErrorPluginProps, TMethods extends ErrorPluginMethods> = Error0 & ErrorResolved<PluginsMapFromParts<TProps, TMethods>> & ErrorOwnMethods<PluginsMapFromParts<TProps, TMethods>> & ErrorResolveMethods<PluginsMapFromParts<TProps, TMethods>> & {
|
|
238
|
+
readonly __pluginsMap?: PluginsMapFromParts<TProps, TMethods>;
|
|
239
|
+
};
|
|
240
|
+
type PluginOfBuilder<TBuilder> = TBuilder extends PluginError0<infer TProps, infer TMethods> ? ErrorPlugin<TProps, TMethods> : never;
|
|
241
|
+
declare class PluginError0<TProps extends ErrorPluginProps = Record<never, never>, TMethods extends ErrorPluginMethods = Record<never, never>> {
|
|
242
|
+
private readonly _plugin;
|
|
243
|
+
readonly Infer: {
|
|
244
|
+
props: TProps;
|
|
245
|
+
methods: TMethods;
|
|
246
|
+
};
|
|
247
|
+
constructor(plugin?: ErrorPlugin<ErrorPluginProps, ErrorPluginMethods>);
|
|
248
|
+
prop<TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, BuilderError0<TProps, TMethods>, TResolveValue>): PluginError0<AddPropToPluginProps<TProps, TKey, TInputValue, TOutputValue, TResolveValue>, TMethods>;
|
|
249
|
+
method<TKey extends string, TMethod extends (error: BuilderError0<TProps, TMethods>, ...args: any[]) => any>(key: TKey, value: TMethod): PluginError0<TProps, AddMethodToPluginMethods<TMethods, TKey, TMethod>>;
|
|
250
|
+
adapt(value: ErrorPluginAdaptFn<BuilderError0<TProps, TMethods>, PluginOutputProps<TProps>>): PluginError0<TProps, TMethods>;
|
|
251
|
+
stack(value: ErrorPluginStack<BuilderError0<TProps, TMethods>>): PluginError0<TProps, TMethods>;
|
|
252
|
+
cause(value: ErrorPluginCause<BuilderError0<TProps, TMethods>>): PluginError0<TProps, TMethods>;
|
|
253
|
+
message(value: ErrorPluginMessage<BuilderError0<TProps, TMethods>>): PluginError0<TProps, TMethods>;
|
|
254
|
+
use<TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, BuilderError0<TProps, TMethods>, TResolveValue>): PluginError0<AddPropToPluginProps<TProps, TKey, TInputValue, TOutputValue, TResolveValue>, TMethods>;
|
|
255
|
+
use<TKey extends string, TMethod extends (error: BuilderError0<TProps, TMethods>, ...args: any[]) => any>(kind: 'method', key: TKey, value: TMethod): PluginError0<TProps, AddMethodToPluginMethods<TMethods, TKey, TMethod>>;
|
|
256
|
+
use(kind: 'adapt', value: ErrorPluginAdaptFn<BuilderError0<TProps, TMethods>, PluginOutputProps<TProps>>): PluginError0<TProps, TMethods>;
|
|
257
|
+
use(kind: 'stack', value: ErrorPluginStack<BuilderError0<TProps, TMethods>>): PluginError0<TProps, TMethods>;
|
|
258
|
+
use(kind: 'cause', value: ErrorPluginCause<BuilderError0<TProps, TMethods>>): PluginError0<TProps, TMethods>;
|
|
259
|
+
use(kind: 'message', value: ErrorPluginMessage<BuilderError0<TProps, TMethods>>): PluginError0<TProps, TMethods>;
|
|
32
260
|
}
|
|
33
|
-
type
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
readonly __I_AM_ERROR_0: true;
|
|
38
|
-
readonly tag?: Error0GeneralProps['tag'];
|
|
39
|
-
readonly code?: Error0GeneralProps['code'];
|
|
40
|
-
readonly httpStatus?: Error0GeneralProps['httpStatus'];
|
|
41
|
-
readonly expected?: Error0GeneralProps['expected'];
|
|
42
|
-
readonly clientMessage?: Error0GeneralProps['clientMessage'];
|
|
43
|
-
readonly anyMessage?: Error0GeneralProps['anyMessage'];
|
|
44
|
-
readonly cause?: Error0GeneralProps['cause'];
|
|
45
|
-
readonly meta?: Meta0.Meta0OrValueTypeNullish;
|
|
46
|
-
readonly zodError?: Error0GeneralProps['zodError'];
|
|
47
|
-
readonly axiosError?: Error0GeneralProps['axiosError'];
|
|
48
|
-
static defaultMessage: string;
|
|
49
|
-
static defaultCode?: Error0GeneralProps['code'];
|
|
50
|
-
static defaultHttpStatus?: Error0GeneralProps['httpStatus'];
|
|
51
|
-
static defaultExpected?: Error0GeneralProps['expected'];
|
|
52
|
-
static defaultClientMessage?: Error0GeneralProps['clientMessage'];
|
|
53
|
-
static defaultMeta?: Meta0.Meta0OrValueTypeNullish;
|
|
54
|
-
readonly propsOriginal: Error0GeneralProps;
|
|
55
|
-
constructor(message: string);
|
|
56
|
-
constructor(input: Error0Input);
|
|
57
|
-
constructor(message: string, input: Error0Input);
|
|
58
|
-
constructor(error: Error);
|
|
59
|
-
constructor(error: Error, input: Error0Input);
|
|
60
|
-
constructor(value: unknown);
|
|
61
|
-
constructor(value: unknown, input: Error0Input);
|
|
62
|
-
static defaultMaxLevel: number;
|
|
63
|
-
static _safeParseInput(error0Input: Record<string, unknown>): Error0Input;
|
|
64
|
-
static _getSelfGeneralProps({ error0Input, message, stack, }: {
|
|
65
|
-
error0Input: Error0Input;
|
|
66
|
-
message: string;
|
|
67
|
-
stack: Error0GeneralProps['stack'];
|
|
68
|
-
}): Error0GeneralProps;
|
|
69
|
-
static _getSelfPropsFloated(causesProps: Error0GeneralProps[]): Error0GeneralProps;
|
|
70
|
-
static _getExtraError0PropsByZodError(zodError: ZodError): Partial<Error0GeneralProps>;
|
|
71
|
-
static _getExtraError0PropsByAxiosError(axiosError: AxiosError): Partial<Error0GeneralProps>;
|
|
72
|
-
static _assignError0Props(error0Props: Error0GeneralProps, extraError0Props: Partial<Error0GeneralProps>): void;
|
|
73
|
-
static _normalizeSelfExpected(error0Props: Error0GeneralProps, expectedProvided: Error0Input['expected']): boolean | undefined;
|
|
74
|
-
static _isExpected(causesProps: Error0GeneralProps[]): boolean;
|
|
75
|
-
static _getPropsFromUnknown(error: unknown, defaults?: Error0Input): Error0GeneralProps;
|
|
76
|
-
static _getCausesPropsFromUnknown(error: unknown, maxLevel: number): Error0GeneralProps[];
|
|
77
|
-
static _getCausesPropsFromError0Props(error0Props: Error0GeneralProps, maxLevel: number): Error0GeneralProps[];
|
|
78
|
-
static _getClosestPropValue<TPropKey extends keyof Error0GeneralProps>(causesProps: Error0GeneralProps[], propKey: TPropKey): NonNullable<Error0GeneralProps[TPropKey]> | undefined;
|
|
79
|
-
static _getFilledPropValues<TPropKey extends keyof Error0Input>(causesProps: Error0GeneralProps[], propKey: TPropKey): NonNullable<Error0GeneralProps[TPropKey]>[];
|
|
80
|
-
static _getMergedMetaValue(causesProps: Error0GeneralProps[]): Meta0.ValueType;
|
|
81
|
-
static _removeConstructorStackPart(stack: Error0GeneralProps['stack']): Error0GeneralProps['stack'];
|
|
82
|
-
static _mergeStack(prevStack: Error0GeneralProps['stack'], nextStack: Error0GeneralProps['stack']): Error0GeneralProps['stack'];
|
|
83
|
-
static isError0(error: unknown): error is Error0;
|
|
84
|
-
static isLikelyError0(error: unknown): error is Error0;
|
|
85
|
-
static _toError0(error: unknown, inputOverride?: Error0Input): Error0;
|
|
86
|
-
static from(error: unknown, inputOverride?: Error0Input): Error0;
|
|
87
|
-
static extend(props: {
|
|
88
|
-
defaultMessage?: Error0GeneralProps['message'];
|
|
89
|
-
defaultCode?: Error0GeneralProps['code'];
|
|
90
|
-
defaultHttpStatus?: Error0GeneralProps['httpStatus'];
|
|
91
|
-
defaultExpected?: Error0GeneralProps['expected'];
|
|
92
|
-
defaultClientMessage?: Error0GeneralProps['clientMessage'];
|
|
93
|
-
defaultMeta?: Meta0.Meta0OrValueTypeNullish;
|
|
94
|
-
}): {
|
|
95
|
-
new (message: string): {
|
|
96
|
-
readonly __I_AM_ERROR_0: true;
|
|
97
|
-
readonly tag?: Error0GeneralProps["tag"];
|
|
98
|
-
readonly code?: Error0GeneralProps["code"];
|
|
99
|
-
readonly httpStatus?: Error0GeneralProps["httpStatus"];
|
|
100
|
-
readonly expected?: Error0GeneralProps["expected"];
|
|
101
|
-
readonly clientMessage?: Error0GeneralProps["clientMessage"];
|
|
102
|
-
readonly anyMessage?: Error0GeneralProps["anyMessage"];
|
|
103
|
-
readonly cause?: Error0GeneralProps["cause"];
|
|
104
|
-
readonly meta?: Meta0.Meta0OrValueTypeNullish;
|
|
105
|
-
readonly zodError?: Error0GeneralProps["zodError"];
|
|
106
|
-
readonly axiosError?: Error0GeneralProps["axiosError"];
|
|
107
|
-
readonly propsOriginal: Error0GeneralProps;
|
|
108
|
-
toJSON(): {
|
|
109
|
-
message: string;
|
|
110
|
-
tag: string | undefined;
|
|
111
|
-
code: string | undefined;
|
|
112
|
-
httpStatus: number | undefined;
|
|
113
|
-
expected: boolean | undefined;
|
|
114
|
-
clientMessage: string | undefined;
|
|
115
|
-
anyMessage: string | undefined;
|
|
116
|
-
cause: unknown;
|
|
117
|
-
meta: Meta0.ValueType;
|
|
118
|
-
stack: string | undefined;
|
|
119
|
-
__I_AM_ERROR_0: true;
|
|
120
|
-
};
|
|
121
|
-
toResponse(data?: Record<string, unknown>): undici_types.Response;
|
|
122
|
-
name: string;
|
|
123
|
-
message: string;
|
|
124
|
-
stack?: string;
|
|
125
|
-
};
|
|
126
|
-
new (input: Error0Input): {
|
|
127
|
-
readonly __I_AM_ERROR_0: true;
|
|
128
|
-
readonly tag?: Error0GeneralProps["tag"];
|
|
129
|
-
readonly code?: Error0GeneralProps["code"];
|
|
130
|
-
readonly httpStatus?: Error0GeneralProps["httpStatus"];
|
|
131
|
-
readonly expected?: Error0GeneralProps["expected"];
|
|
132
|
-
readonly clientMessage?: Error0GeneralProps["clientMessage"];
|
|
133
|
-
readonly anyMessage?: Error0GeneralProps["anyMessage"];
|
|
134
|
-
readonly cause?: Error0GeneralProps["cause"];
|
|
135
|
-
readonly meta?: Meta0.Meta0OrValueTypeNullish;
|
|
136
|
-
readonly zodError?: Error0GeneralProps["zodError"];
|
|
137
|
-
readonly axiosError?: Error0GeneralProps["axiosError"];
|
|
138
|
-
readonly propsOriginal: Error0GeneralProps;
|
|
139
|
-
toJSON(): {
|
|
140
|
-
message: string;
|
|
141
|
-
tag: string | undefined;
|
|
142
|
-
code: string | undefined;
|
|
143
|
-
httpStatus: number | undefined;
|
|
144
|
-
expected: boolean | undefined;
|
|
145
|
-
clientMessage: string | undefined;
|
|
146
|
-
anyMessage: string | undefined;
|
|
147
|
-
cause: unknown;
|
|
148
|
-
meta: Meta0.ValueType;
|
|
149
|
-
stack: string | undefined;
|
|
150
|
-
__I_AM_ERROR_0: true;
|
|
151
|
-
};
|
|
152
|
-
toResponse(data?: Record<string, unknown>): undici_types.Response;
|
|
153
|
-
name: string;
|
|
154
|
-
message: string;
|
|
155
|
-
stack?: string;
|
|
156
|
-
};
|
|
157
|
-
new (message: string, input: Error0Input): {
|
|
158
|
-
readonly __I_AM_ERROR_0: true;
|
|
159
|
-
readonly tag?: Error0GeneralProps["tag"];
|
|
160
|
-
readonly code?: Error0GeneralProps["code"];
|
|
161
|
-
readonly httpStatus?: Error0GeneralProps["httpStatus"];
|
|
162
|
-
readonly expected?: Error0GeneralProps["expected"];
|
|
163
|
-
readonly clientMessage?: Error0GeneralProps["clientMessage"];
|
|
164
|
-
readonly anyMessage?: Error0GeneralProps["anyMessage"];
|
|
165
|
-
readonly cause?: Error0GeneralProps["cause"];
|
|
166
|
-
readonly meta?: Meta0.Meta0OrValueTypeNullish;
|
|
167
|
-
readonly zodError?: Error0GeneralProps["zodError"];
|
|
168
|
-
readonly axiosError?: Error0GeneralProps["axiosError"];
|
|
169
|
-
readonly propsOriginal: Error0GeneralProps;
|
|
170
|
-
toJSON(): {
|
|
171
|
-
message: string;
|
|
172
|
-
tag: string | undefined;
|
|
173
|
-
code: string | undefined;
|
|
174
|
-
httpStatus: number | undefined;
|
|
175
|
-
expected: boolean | undefined;
|
|
176
|
-
clientMessage: string | undefined;
|
|
177
|
-
anyMessage: string | undefined;
|
|
178
|
-
cause: unknown;
|
|
179
|
-
meta: Meta0.ValueType;
|
|
180
|
-
stack: string | undefined;
|
|
181
|
-
__I_AM_ERROR_0: true;
|
|
182
|
-
};
|
|
183
|
-
toResponse(data?: Record<string, unknown>): undici_types.Response;
|
|
184
|
-
name: string;
|
|
185
|
-
message: string;
|
|
186
|
-
stack?: string;
|
|
187
|
-
};
|
|
188
|
-
new (error: Error): {
|
|
189
|
-
readonly __I_AM_ERROR_0: true;
|
|
190
|
-
readonly tag?: Error0GeneralProps["tag"];
|
|
191
|
-
readonly code?: Error0GeneralProps["code"];
|
|
192
|
-
readonly httpStatus?: Error0GeneralProps["httpStatus"];
|
|
193
|
-
readonly expected?: Error0GeneralProps["expected"];
|
|
194
|
-
readonly clientMessage?: Error0GeneralProps["clientMessage"];
|
|
195
|
-
readonly anyMessage?: Error0GeneralProps["anyMessage"];
|
|
196
|
-
readonly cause?: Error0GeneralProps["cause"];
|
|
197
|
-
readonly meta?: Meta0.Meta0OrValueTypeNullish;
|
|
198
|
-
readonly zodError?: Error0GeneralProps["zodError"];
|
|
199
|
-
readonly axiosError?: Error0GeneralProps["axiosError"];
|
|
200
|
-
readonly propsOriginal: Error0GeneralProps;
|
|
201
|
-
toJSON(): {
|
|
202
|
-
message: string;
|
|
203
|
-
tag: string | undefined;
|
|
204
|
-
code: string | undefined;
|
|
205
|
-
httpStatus: number | undefined;
|
|
206
|
-
expected: boolean | undefined;
|
|
207
|
-
clientMessage: string | undefined;
|
|
208
|
-
anyMessage: string | undefined;
|
|
209
|
-
cause: unknown;
|
|
210
|
-
meta: Meta0.ValueType;
|
|
211
|
-
stack: string | undefined;
|
|
212
|
-
__I_AM_ERROR_0: true;
|
|
213
|
-
};
|
|
214
|
-
toResponse(data?: Record<string, unknown>): undici_types.Response;
|
|
215
|
-
name: string;
|
|
216
|
-
message: string;
|
|
217
|
-
stack?: string;
|
|
218
|
-
};
|
|
219
|
-
new (error: Error, input: Error0Input): {
|
|
220
|
-
readonly __I_AM_ERROR_0: true;
|
|
221
|
-
readonly tag?: Error0GeneralProps["tag"];
|
|
222
|
-
readonly code?: Error0GeneralProps["code"];
|
|
223
|
-
readonly httpStatus?: Error0GeneralProps["httpStatus"];
|
|
224
|
-
readonly expected?: Error0GeneralProps["expected"];
|
|
225
|
-
readonly clientMessage?: Error0GeneralProps["clientMessage"];
|
|
226
|
-
readonly anyMessage?: Error0GeneralProps["anyMessage"];
|
|
227
|
-
readonly cause?: Error0GeneralProps["cause"];
|
|
228
|
-
readonly meta?: Meta0.Meta0OrValueTypeNullish;
|
|
229
|
-
readonly zodError?: Error0GeneralProps["zodError"];
|
|
230
|
-
readonly axiosError?: Error0GeneralProps["axiosError"];
|
|
231
|
-
readonly propsOriginal: Error0GeneralProps;
|
|
232
|
-
toJSON(): {
|
|
233
|
-
message: string;
|
|
234
|
-
tag: string | undefined;
|
|
235
|
-
code: string | undefined;
|
|
236
|
-
httpStatus: number | undefined;
|
|
237
|
-
expected: boolean | undefined;
|
|
238
|
-
clientMessage: string | undefined;
|
|
239
|
-
anyMessage: string | undefined;
|
|
240
|
-
cause: unknown;
|
|
241
|
-
meta: Meta0.ValueType;
|
|
242
|
-
stack: string | undefined;
|
|
243
|
-
__I_AM_ERROR_0: true;
|
|
244
|
-
};
|
|
245
|
-
toResponse(data?: Record<string, unknown>): undici_types.Response;
|
|
246
|
-
name: string;
|
|
247
|
-
message: string;
|
|
248
|
-
stack?: string;
|
|
249
|
-
};
|
|
250
|
-
new (value: unknown): {
|
|
251
|
-
readonly __I_AM_ERROR_0: true;
|
|
252
|
-
readonly tag?: Error0GeneralProps["tag"];
|
|
253
|
-
readonly code?: Error0GeneralProps["code"];
|
|
254
|
-
readonly httpStatus?: Error0GeneralProps["httpStatus"];
|
|
255
|
-
readonly expected?: Error0GeneralProps["expected"];
|
|
256
|
-
readonly clientMessage?: Error0GeneralProps["clientMessage"];
|
|
257
|
-
readonly anyMessage?: Error0GeneralProps["anyMessage"];
|
|
258
|
-
readonly cause?: Error0GeneralProps["cause"];
|
|
259
|
-
readonly meta?: Meta0.Meta0OrValueTypeNullish;
|
|
260
|
-
readonly zodError?: Error0GeneralProps["zodError"];
|
|
261
|
-
readonly axiosError?: Error0GeneralProps["axiosError"];
|
|
262
|
-
readonly propsOriginal: Error0GeneralProps;
|
|
263
|
-
toJSON(): {
|
|
264
|
-
message: string;
|
|
265
|
-
tag: string | undefined;
|
|
266
|
-
code: string | undefined;
|
|
267
|
-
httpStatus: number | undefined;
|
|
268
|
-
expected: boolean | undefined;
|
|
269
|
-
clientMessage: string | undefined;
|
|
270
|
-
anyMessage: string | undefined;
|
|
271
|
-
cause: unknown;
|
|
272
|
-
meta: Meta0.ValueType;
|
|
273
|
-
stack: string | undefined;
|
|
274
|
-
__I_AM_ERROR_0: true;
|
|
275
|
-
};
|
|
276
|
-
toResponse(data?: Record<string, unknown>): undici_types.Response;
|
|
277
|
-
name: string;
|
|
278
|
-
message: string;
|
|
279
|
-
stack?: string;
|
|
280
|
-
};
|
|
281
|
-
new (value: unknown, input: Error0Input): {
|
|
282
|
-
readonly __I_AM_ERROR_0: true;
|
|
283
|
-
readonly tag?: Error0GeneralProps["tag"];
|
|
284
|
-
readonly code?: Error0GeneralProps["code"];
|
|
285
|
-
readonly httpStatus?: Error0GeneralProps["httpStatus"];
|
|
286
|
-
readonly expected?: Error0GeneralProps["expected"];
|
|
287
|
-
readonly clientMessage?: Error0GeneralProps["clientMessage"];
|
|
288
|
-
readonly anyMessage?: Error0GeneralProps["anyMessage"];
|
|
289
|
-
readonly cause?: Error0GeneralProps["cause"];
|
|
290
|
-
readonly meta?: Meta0.Meta0OrValueTypeNullish;
|
|
291
|
-
readonly zodError?: Error0GeneralProps["zodError"];
|
|
292
|
-
readonly axiosError?: Error0GeneralProps["axiosError"];
|
|
293
|
-
readonly propsOriginal: Error0GeneralProps;
|
|
294
|
-
toJSON(): {
|
|
295
|
-
message: string;
|
|
296
|
-
tag: string | undefined;
|
|
297
|
-
code: string | undefined;
|
|
298
|
-
httpStatus: number | undefined;
|
|
299
|
-
expected: boolean | undefined;
|
|
300
|
-
clientMessage: string | undefined;
|
|
301
|
-
anyMessage: string | undefined;
|
|
302
|
-
cause: unknown;
|
|
303
|
-
meta: Meta0.ValueType;
|
|
304
|
-
stack: string | undefined;
|
|
305
|
-
__I_AM_ERROR_0: true;
|
|
306
|
-
};
|
|
307
|
-
toResponse(data?: Record<string, unknown>): undici_types.Response;
|
|
308
|
-
name: string;
|
|
309
|
-
message: string;
|
|
310
|
-
stack?: string;
|
|
311
|
-
};
|
|
312
|
-
defaultMessage: string;
|
|
313
|
-
defaultCode: string | undefined;
|
|
314
|
-
defaultHttpStatus: number | undefined;
|
|
315
|
-
defaultExpected: boolean | undefined;
|
|
316
|
-
defaultClientMessage: string | undefined;
|
|
317
|
-
defaultMeta: Meta0;
|
|
318
|
-
defaultMaxLevel: number;
|
|
319
|
-
_safeParseInput(error0Input: Record<string, unknown>): Error0Input;
|
|
320
|
-
_getSelfGeneralProps({ error0Input, message, stack, }: {
|
|
321
|
-
error0Input: Error0Input;
|
|
322
|
-
message: string;
|
|
323
|
-
stack: Error0GeneralProps["stack"];
|
|
324
|
-
}): Error0GeneralProps;
|
|
325
|
-
_getSelfPropsFloated(causesProps: Error0GeneralProps[]): Error0GeneralProps;
|
|
326
|
-
_getExtraError0PropsByZodError(zodError: ZodError): Partial<Error0GeneralProps>;
|
|
327
|
-
_getExtraError0PropsByAxiosError(axiosError: AxiosError): Partial<Error0GeneralProps>;
|
|
328
|
-
_assignError0Props(error0Props: Error0GeneralProps, extraError0Props: Partial<Error0GeneralProps>): void;
|
|
329
|
-
_normalizeSelfExpected(error0Props: Error0GeneralProps, expectedProvided: Error0Input["expected"]): boolean | undefined;
|
|
330
|
-
_isExpected(causesProps: Error0GeneralProps[]): boolean;
|
|
331
|
-
_getPropsFromUnknown(error: unknown, defaults?: Error0Input): Error0GeneralProps;
|
|
332
|
-
_getCausesPropsFromUnknown(error: unknown, maxLevel: number): Error0GeneralProps[];
|
|
333
|
-
_getCausesPropsFromError0Props(error0Props: Error0GeneralProps, maxLevel: number): Error0GeneralProps[];
|
|
334
|
-
_getClosestPropValue<TPropKey extends keyof Error0GeneralProps>(causesProps: Error0GeneralProps[], propKey: TPropKey): NonNullable<Error0GeneralProps[TPropKey]> | undefined;
|
|
335
|
-
_getFilledPropValues<TPropKey extends keyof Error0Input>(causesProps: Error0GeneralProps[], propKey: TPropKey): NonNullable<Error0GeneralProps[TPropKey]>[];
|
|
336
|
-
_getMergedMetaValue(causesProps: Error0GeneralProps[]): Meta0.ValueType;
|
|
337
|
-
_removeConstructorStackPart(stack: Error0GeneralProps["stack"]): Error0GeneralProps["stack"];
|
|
338
|
-
_mergeStack(prevStack: Error0GeneralProps["stack"], nextStack: Error0GeneralProps["stack"]): Error0GeneralProps["stack"];
|
|
339
|
-
isError0(error: unknown): error is Error0;
|
|
340
|
-
isLikelyError0(error: unknown): error is Error0;
|
|
341
|
-
_toError0(error: unknown, inputOverride?: Error0Input): Error0;
|
|
342
|
-
from(error: unknown, inputOverride?: Error0Input): Error0;
|
|
343
|
-
extend(props: {
|
|
344
|
-
defaultMessage?: Error0GeneralProps["message"];
|
|
345
|
-
defaultCode?: Error0GeneralProps["code"];
|
|
346
|
-
defaultHttpStatus?: Error0GeneralProps["httpStatus"];
|
|
347
|
-
defaultExpected?: Error0GeneralProps["expected"];
|
|
348
|
-
defaultClientMessage?: Error0GeneralProps["clientMessage"];
|
|
349
|
-
defaultMeta?: Meta0.Meta0OrValueTypeNullish;
|
|
350
|
-
}): /*elided*/ any;
|
|
351
|
-
extendCollection<T extends Record<string, typeof Error0>>(classes: T, props: {
|
|
352
|
-
defaultMessage?: Error0GeneralProps["message"];
|
|
353
|
-
defaultCode?: Error0GeneralProps["code"];
|
|
354
|
-
defaultHttpStatus?: Error0GeneralProps["httpStatus"];
|
|
355
|
-
defaultExpected?: Error0GeneralProps["expected"];
|
|
356
|
-
defaultClientMessage?: Error0GeneralProps["clientMessage"];
|
|
357
|
-
defaultMeta?: Meta0.Meta0OrValueTypeNullish;
|
|
358
|
-
}): T;
|
|
359
|
-
toJSON(error: unknown, inputOverride?: Error0Input): {
|
|
360
|
-
message: string;
|
|
361
|
-
tag: string | undefined;
|
|
362
|
-
code: string | undefined;
|
|
363
|
-
httpStatus: number | undefined;
|
|
364
|
-
expected: boolean | undefined;
|
|
365
|
-
clientMessage: string | undefined;
|
|
366
|
-
anyMessage: string | undefined;
|
|
367
|
-
cause: unknown;
|
|
368
|
-
meta: Meta0.ValueType;
|
|
369
|
-
stack: string | undefined;
|
|
370
|
-
__I_AM_ERROR_0: true;
|
|
371
|
-
};
|
|
372
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
373
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
374
|
-
stackTraceLimit: number;
|
|
261
|
+
type ClassError0<TPluginsMap extends ErrorPluginsMap = EmptyPluginsMap> = {
|
|
262
|
+
MAX_CAUSES_DEPTH: number;
|
|
263
|
+
new (message: string, input?: ErrorInput<TPluginsMap>): Error0 & ErrorResolved<TPluginsMap> & ErrorOwnMethods<TPluginsMap> & ErrorResolveMethods<TPluginsMap> & {
|
|
264
|
+
readonly __pluginsMap?: TPluginsMap;
|
|
375
265
|
};
|
|
376
|
-
|
|
377
|
-
defaultMessage?: Error0GeneralProps['message'];
|
|
378
|
-
defaultCode?: Error0GeneralProps['code'];
|
|
379
|
-
defaultHttpStatus?: Error0GeneralProps['httpStatus'];
|
|
380
|
-
defaultExpected?: Error0GeneralProps['expected'];
|
|
381
|
-
defaultClientMessage?: Error0GeneralProps['clientMessage'];
|
|
382
|
-
defaultMeta?: Meta0.Meta0OrValueTypeNullish;
|
|
383
|
-
}): T;
|
|
384
|
-
toJSON(): {
|
|
266
|
+
new (input: {
|
|
385
267
|
message: string;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
httpStatus: number | undefined;
|
|
389
|
-
expected: boolean | undefined;
|
|
390
|
-
clientMessage: string | undefined;
|
|
391
|
-
anyMessage: string | undefined;
|
|
392
|
-
cause: unknown;
|
|
393
|
-
meta: Meta0.ValueType;
|
|
394
|
-
stack: string | undefined;
|
|
395
|
-
__I_AM_ERROR_0: true;
|
|
268
|
+
} & ErrorInput<TPluginsMap>): Error0 & ErrorResolved<TPluginsMap> & ErrorOwnMethods<TPluginsMap> & ErrorResolveMethods<TPluginsMap> & {
|
|
269
|
+
readonly __pluginsMap?: TPluginsMap;
|
|
396
270
|
};
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
clientMessage: string | undefined;
|
|
404
|
-
anyMessage: string | undefined;
|
|
405
|
-
cause: unknown;
|
|
406
|
-
meta: Meta0.ValueType;
|
|
407
|
-
stack: string | undefined;
|
|
408
|
-
__I_AM_ERROR_0: true;
|
|
271
|
+
readonly __pluginsMap?: TPluginsMap;
|
|
272
|
+
from: (error: unknown) => Error0 & ErrorResolved<TPluginsMap> & ErrorOwnMethods<TPluginsMap> & ErrorResolveMethods<TPluginsMap>;
|
|
273
|
+
round: (error: unknown, isPublic?: boolean) => Error0 & ErrorResolved<TPluginsMap> & ErrorOwnMethods<TPluginsMap> & ErrorResolveMethods<TPluginsMap>;
|
|
274
|
+
causes: {
|
|
275
|
+
(error: unknown, instancesOnly?: false): unknown[];
|
|
276
|
+
(error: unknown, instancesOnly: true): Array<Error0 & ErrorResolved<TPluginsMap> & ErrorOwnMethods<TPluginsMap> & ErrorResolveMethods<TPluginsMap>>;
|
|
409
277
|
};
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
278
|
+
resolve: (error: unknown) => ErrorResolvedProps<TPluginsMap>;
|
|
279
|
+
serialize: (error: unknown, isPublic?: boolean) => Record<string, unknown>;
|
|
280
|
+
own: {
|
|
281
|
+
(error: object): ErrorOwnProps<TPluginsMap>;
|
|
282
|
+
<TKey extends keyof TPluginsMap['props'] & string>(error: object, key: TKey): ErrorOwnProps<TPluginsMap>[TKey];
|
|
283
|
+
};
|
|
284
|
+
flow: <TKey extends keyof TPluginsMap['props'] & string>(error: object, key: TKey) => Array<ErrorOwnProps<TPluginsMap>[TKey]>;
|
|
285
|
+
use: {
|
|
286
|
+
<TBuilder extends PluginError0>(plugin: TBuilder): ClassError0<ExtendErrorPluginsMap<TPluginsMap, PluginOfBuilder<TBuilder>>>;
|
|
287
|
+
<TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<TPluginsMap>, TResolveValue>): ClassError0<ExtendErrorPluginsMapWithProp<TPluginsMap, TKey, TInputValue, TOutputValue, TResolveValue>>;
|
|
288
|
+
<TKey extends string, TMethod extends (error: ErrorInstanceOfMap<TPluginsMap>, ...args: any[]) => any>(kind: 'method', key: TKey, value: TMethod): ClassError0<ExtendErrorPluginsMapWithMethod<TPluginsMap, TKey, TMethod>>;
|
|
289
|
+
(kind: 'adapt', value: ErrorPluginAdaptFn<ErrorInstanceOfMap<TPluginsMap>, ErrorResolvedProps<TPluginsMap>>): ClassError0<TPluginsMap>;
|
|
290
|
+
(kind: 'stack', value: ErrorPluginStack<ErrorInstanceOfMap<TPluginsMap>>): ClassError0<TPluginsMap>;
|
|
291
|
+
(kind: 'cause', value: ErrorPluginCause<ErrorInstanceOfMap<TPluginsMap>>): ClassError0<TPluginsMap>;
|
|
292
|
+
(kind: 'message', value: ErrorPluginMessage<ErrorInstanceOfMap<TPluginsMap>>): ClassError0<TPluginsMap>;
|
|
293
|
+
};
|
|
294
|
+
plugin: () => PluginError0;
|
|
295
|
+
} & ErrorStaticMethods<TPluginsMap>;
|
|
296
|
+
declare class Error0 extends Error {
|
|
297
|
+
static readonly __pluginsMap?: EmptyPluginsMap;
|
|
298
|
+
readonly __pluginsMap?: EmptyPluginsMap;
|
|
299
|
+
static MAX_CAUSES_DEPTH: number;
|
|
300
|
+
protected static _plugins: ErrorPlugin[];
|
|
301
|
+
protected static _resolvedPlugin?: ErrorPluginResolved;
|
|
302
|
+
private static readonly _emptyPlugin;
|
|
303
|
+
private static _indexResolvedPlugin;
|
|
304
|
+
private static _applyPlugin;
|
|
305
|
+
private static _mergeResolvedPlugin;
|
|
306
|
+
private static _getResolvedPlugin;
|
|
307
|
+
constructor(message: string, input?: ErrorInput<EmptyPluginsMap>);
|
|
308
|
+
constructor(input: {
|
|
309
|
+
message: string;
|
|
310
|
+
} & ErrorInput<EmptyPluginsMap>);
|
|
311
|
+
private static _getOwnStore;
|
|
312
|
+
private static readonly isOwnProperty;
|
|
313
|
+
private static _ownByKey;
|
|
314
|
+
private static _flowByKey;
|
|
315
|
+
static own<TThis extends typeof Error0>(this: TThis, error: unknown): ErrorOwnProps<PluginsMapOf<TThis>>;
|
|
316
|
+
static own<TThis extends typeof Error0, TKey extends keyof PluginsMapOf<TThis>['props'] & string>(this: TThis, error: unknown, key: TKey): ErrorOwnProps<PluginsMapOf<TThis>>[TKey];
|
|
317
|
+
own<TThis extends Error0>(this: TThis): ErrorOwnProps<PluginsMapOfInstance<TThis>>;
|
|
318
|
+
own<TThis extends Error0, TKey extends keyof PluginsMapOfInstance<TThis>['props'] & string>(this: TThis, key: TKey): ErrorOwnProps<PluginsMapOfInstance<TThis>>[TKey];
|
|
319
|
+
static flow<TThis extends typeof Error0, TKey extends keyof PluginsMapOf<TThis>['props'] & string>(this: TThis, error: unknown, key: TKey): Array<ErrorOwnProps<PluginsMapOf<TThis>>[TKey]>;
|
|
320
|
+
flow<TThis extends Error0, TKey extends keyof PluginsMapOfInstance<TThis>['props'] & string>(this: TThis, key: TKey): Array<ErrorOwnProps<PluginsMapOfInstance<TThis>>[TKey]>;
|
|
321
|
+
static _resolveByKey(error: Error0, key: string, plugin: ErrorPluginResolved): unknown;
|
|
322
|
+
static resolve<TThis extends typeof Error0>(this: TThis, error: unknown): ErrorResolvedProps<PluginsMapOf<TThis>>;
|
|
323
|
+
static resolve(error: unknown): Record<string, unknown>;
|
|
324
|
+
resolve<TThis extends Error0>(this: TThis): ErrorResolvedProps<PluginsMapOfInstance<TThis>>;
|
|
325
|
+
static causes(error: unknown, instancesOnly?: false): unknown[];
|
|
326
|
+
static causes<T extends typeof Error0>(this: T, error: unknown, instancesOnly: true): Array<InstanceType<T>>;
|
|
327
|
+
causes<TThis extends Error0>(this: TThis, instancesOnly?: false): [TThis, ...unknown[]];
|
|
328
|
+
causes<TThis extends Error0>(this: TThis, instancesOnly: true): [TThis, ...TThis[]];
|
|
329
|
+
static is<T extends typeof Error0>(this: T, error: unknown): error is InstanceType<T>;
|
|
330
|
+
static isSerialized(error: unknown): error is Record<string, unknown>;
|
|
331
|
+
static from(error: unknown): Error0;
|
|
332
|
+
static round(error: unknown, isPublic?: boolean): Error0;
|
|
333
|
+
private static _applyAdapt;
|
|
334
|
+
private static _fromSerialized;
|
|
335
|
+
private static _fromNonError0;
|
|
336
|
+
private static _extractMessage;
|
|
337
|
+
private static _useWithPlugin;
|
|
338
|
+
private static _pluginFromBuilder;
|
|
339
|
+
static use<TThis extends typeof Error0, TBuilder extends PluginError0>(this: TThis, plugin: TBuilder): ClassError0<ExtendErrorPluginsMap<PluginsMapOf<TThis>, PluginOfBuilder<TBuilder>>>;
|
|
340
|
+
static use<TThis extends typeof Error0, TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(this: TThis, kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<PluginsMapOf<TThis>>, TResolveValue>): ClassError0<ExtendErrorPluginsMapWithProp<PluginsMapOf<TThis>, TKey, TInputValue, TOutputValue, TResolveValue>>;
|
|
341
|
+
static use<TThis extends typeof Error0, TKey extends string, TMethod extends (error: ErrorInstanceOfMap<PluginsMapOf<TThis>>, ...args: any[]) => any>(this: TThis, kind: 'method', key: TKey, value: TMethod): ClassError0<ExtendErrorPluginsMapWithMethod<PluginsMapOf<TThis>, TKey, TMethod>>;
|
|
342
|
+
static use<TThis extends typeof Error0>(this: TThis, kind: 'adapt', value: ErrorPluginAdaptFn<ErrorInstanceOfMap<PluginsMapOf<TThis>>, ErrorResolvedProps<PluginsMapOf<TThis>>>): ClassError0<PluginsMapOf<TThis>>;
|
|
343
|
+
static use<TThis extends typeof Error0>(this: TThis, kind: 'stack', value: ErrorPluginStack<ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<PluginsMapOf<TThis>>;
|
|
344
|
+
static use<TThis extends typeof Error0>(this: TThis, kind: 'cause', value: ErrorPluginCause<ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<PluginsMapOf<TThis>>;
|
|
345
|
+
static use<TThis extends typeof Error0>(this: TThis, kind: 'message', value: ErrorPluginMessage<ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<PluginsMapOf<TThis>>;
|
|
346
|
+
static plugin(): PluginError0;
|
|
347
|
+
static serialize(error: unknown, isPublic?: boolean): Record<string, unknown>;
|
|
348
|
+
serialize(isPublic?: boolean): Record<string, unknown>;
|
|
349
|
+
round<TThis extends Error0>(this: TThis, isPublic?: boolean): TThis;
|
|
415
350
|
}
|
|
416
|
-
declare const e0s: {
|
|
417
|
-
Default: typeof Error0;
|
|
418
|
-
Expected: typeof Error0;
|
|
419
|
-
};
|
|
420
351
|
|
|
421
|
-
export { Error0, type
|
|
352
|
+
export { type ClassError0, Error0, type ErrorInput, type ErrorInputBase, type ErrorPlugin, type ErrorPluginAdaptFn, type ErrorPluginAdaptResult, type ErrorPluginCause, type ErrorPluginCauseDeserialize, type ErrorPluginCauseSerialize, type ErrorPluginMessage, type ErrorPluginMessageSerialize, type ErrorPluginMethodFn, type ErrorPluginMethods, type ErrorPluginPropOptions, type ErrorPluginProps, type ErrorPluginStack, type ErrorPluginStackSerialize, type ErrorPluginsMap, type ErrorResolved, type IsEmptyObject, PluginError0 };
|