Total Complexity | 2 |
Complexity/F | 2 |
Lines of Code | 32 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 100% |
Changes | 0 |
1 | abstract class ApplicationError extends Error { |
||
2 | protected constructor(errorType: string, errorMessage: string) { |
||
3 | 7 | super(errorMessage); |
|
4 | 7 | this.name = errorType; |
|
5 | 7 | this.captureStackTrace(); |
|
6 | } |
||
7 | |||
8 | private captureStackTrace(): void { |
||
9 | 7 | if (Error.captureStackTrace) { |
|
10 | 7 | Error.captureStackTrace(this, this.constructor); |
|
11 | } |
||
12 | } |
||
13 | } |
||
14 | |||
15 | 2 | export class NetworkError extends ApplicationError { |
|
16 | constructor(message: string) { |
||
17 | 4 | super("NetworkError", message); |
|
18 | } |
||
19 | } |
||
20 | |||
21 | 2 | export class ServerError extends ApplicationError { |
|
22 | constructor(message: string) { |
||
23 | 2 | super("ServerError", message); |
|
24 | } |
||
25 | } |
||
26 | |||
27 | 2 | export class DataError extends ApplicationError { |
|
28 | constructor(message: string) { |
||
29 | 1 | super("DataError", message); |
|
30 | } |
||
31 | } |
||
32 |