-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherr.d.ts
More file actions
50 lines (43 loc) · 1.11 KB
/
err.d.ts
File metadata and controls
50 lines (43 loc) · 1.11 KB
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
export interface ErrObject extends Error {
/**
* Message breadcrumbs added during the error's lifetime.
*/
msgs: string[];
/**
* Context snapshot captured at the moment the error was created,
* and enriched through OnErr.
*/
original: Record<string, any>;
/**
* Append a message to msgs[].
*/
m(message: string): this;
/**
* Attach flags to the error. Same as the flag_dict parameter.
*/
f(flag_dict: Record<string, any> | string): this;
/**
* Merge context into original. Same as the context_dict parameter.
*/
c(context_dict: Record<string, any>): this;
/**
* Any additional safe properties passed via `flag_dict`.
*/
[key: string]: any;
}
/**
* Create a new enhanced Error with context and safe custom properties.
*/
export function Err(
msg?: string,
context_dict?: Record<string, any>,
flag_dict?: Record<string, any> | string
): ErrObject;
/**
* Enrich an existing error with new context and safe custom properties.
*/
export function OnErr(
err: any,
context_dict?: Record<string, any>,
flag_dict?: Record<string, any> | string
): ErrObject;