• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dreamsparkx / node-ts-starter / 13675028562

05 Mar 2025 11:32AM UTC coverage: 79.855% (-3.1%) from 82.915%
13675028562

Pull #1136

github

Gaurav Bharti
chore(yml): remove yml
Pull Request #1136: feat(migrate): migrate to pnpm

66 of 91 branches covered (72.53%)

Branch coverage included in aggregate %.

13 of 13 new or added lines in 1 file covered. (100.0%)

57 existing lines in 9 files now uncovered.

596 of 738 relevant lines covered (80.76%)

1.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.14
/src/util/error.ts
1
import logger from "./logger";
1✔
2

3
export class GeneralError extends Error {
1✔
4
  errors?: unknown[];
5
  constructor(message: string, errors?: unknown[]) {
1✔
6
    super(message);
8✔
7
    this.errors = errors;
8✔
8
  }
8✔
9
  /**
10
   * Returns status code of the type of error initialized
11
   * @returns status code of the type of error initialized
12
   */
13
  getCode() {
1✔
14
    if (this instanceof BadRequestError) {
8✔
15
      return 400;
4✔
16
    } else if (this instanceof UnAuthorizedRequestError) {
4✔
17
      return 401;
1✔
18
    } else if (this instanceof ForbiddenError) {
4✔
19
      return 403;
1✔
20
    } else if (this instanceof NotAcceptableError) {
3✔
21
      return 406;
1✔
22
    } else if (this instanceof ConflictError) {
1✔
23
      return 409;
1✔
24
    } else if (this instanceof InternalServerError) {
1!
25
      return 500;
×
UNCOV
26
    }
×
27
  }
8✔
28
}
1✔
29

30
export class ForbiddenError extends GeneralError {
1✔
31
  constructor(message: string, errors?: unknown[]) {
1✔
32
    super(message, errors);
1✔
33
  }
1✔
34
}
1✔
35

36
export class NotAcceptableError extends GeneralError {
1✔
37
  constructor(message: string) {
1✔
38
    super(message);
1✔
39
  }
1✔
40
}
1✔
41

42
export class ConflictError extends GeneralError {
1✔
43
  constructor(message: string) {
1✔
44
    super(message);
1✔
45
  }
1✔
46
}
1✔
47

48
export class BadRequestError extends GeneralError {
1✔
49
  constructor(message: string, errors?: unknown[]) {
1✔
50
    super(message, errors);
4✔
51
  }
4✔
52
}
1✔
53

54
export class InternalServerError extends GeneralError {
1✔
55
  constructor(
1✔
UNCOV
56
    message: string = "Internal Server Error",
×
UNCOV
57
    errors?: unknown[],
×
UNCOV
58
  ) {
×
59
    super(message);
×
60
    logger.error(message, errors);
×
UNCOV
61
  }
×
62
}
1✔
63

64
export class UnAuthorizedRequestError extends GeneralError {
1✔
65
  constructor(message: string) {
1✔
66
    super(message);
1✔
67
  }
1✔
68
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc