Passed
Push — main ( 085602...a6fcf3 )
by Yuri
01:24 queued 14s
created

src/errors.ts   A

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 32
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 21
mnd 1
bc 1
fnc 1
dl 0
loc 32
bpm 1
cpm 2
noi 0
c 0
b 0
f 0
ccs 11
cts 11
cp 1
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A ApplicationError.captureStackTrace 0 4 2
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