1 | import { IDetailedError } from './definitions';
|
2 |
|
3 |
|
4 |
|
5 | export declare class Exception extends Error {
|
6 | message: string;
|
7 | name: string;
|
8 | stack: string;
|
9 | constructor(message?: string);
|
10 | toString(): string;
|
11 | }
|
12 | /**
|
13 | * An error with generic error details.
|
14 | *
|
15 | * Error details can be extracted depending on the type of `D`. For instance,
|
16 | * if the type of `D` is `string[]`, you can do this:
|
17 | *
|
18 | * ```typescript
|
19 | * function handleError(err: IDetailedError<string[]>) {
|
20 | * for (let i in err.details) {
|
21 | * console.error('got error code: ' + i);
|
22 | * }
|
23 | * }
|
24 | * ```
|
25 | *
|
26 | * @featured
|
27 | */
|
28 | export declare class DetailedError<D> extends Exception implements IDetailedError<D> {
|
29 | /**
|
30 | * The error message.
|
31 | */
|
32 | message: string;
|
33 | /**
|
34 | * The error details.
|
35 | */
|
36 | details: D;
|
37 | constructor(
|
38 | /**
|
39 | * The error message.
|
40 | */
|
41 | message?: string,
|
42 | /**
|
43 | * The error details.
|
44 | */
|
45 | details?: D);
|
46 | }
|
47 |
|
\ | No newline at end of file |