1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export class AppError extends Error {
|
10 | |
11 |
|
12 |
|
13 |
|
14 | static instanceOf(value: any): value is AppError;
|
15 | |
16 |
|
17 |
|
18 |
|
19 |
|
20 | static notFound(info?: Record<string, any> | undefined, error?: Error | undefined): AppError;
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 | static notImplemented(info?: Record<string, any> | undefined, error?: Error | undefined): AppError;
|
27 | |
28 |
|
29 |
|
30 |
|
31 |
|
32 | static serverError(info?: Record<string, any> | undefined, error?: Error | undefined): AppError;
|
33 | |
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | static validationError(key: string, info?: Record<string, any> | undefined, error?: Error | undefined): AppError;
|
40 | |
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | static format(e?: AppError | Error | undefined | null | {}): Record<string, any>;
|
47 | |
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | constructor(key: string, status: number, info?: Record<string, any> | undefined, originalError?: Error | undefined);
|
54 | key: string;
|
55 | status: number;
|
56 | info: Record<string, any>;
|
57 | originalError: Error | undefined;
|
58 | /**
|
59 | * Use AppError#format when AppError is passed to JSON.stringify().
|
60 | * This is used in the compas insight logger in production mode.
|
61 | */
|
62 | toJSON(): Record<string, any>;
|
63 | /**
|
64 | * Use AppError#format when AppError is passed to console.log / console.error.
|
65 | * This works because it uses `util.inspect` under the hood.
|
66 | * Util#inspect checks if the Symbol `util.inspect.custom` is available.
|
67 | */
|
68 | [inspect.custom](): Record<string, any>;
|
69 | }
|
70 | import { inspect } from "util";
|
71 |
|
\ | No newline at end of file |