All files error.ts

100% Statements 14/14
75% Branches 3/4
100% Functions 3/3
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 223x 3x 3x 3x 3x 3x 3x       3x       3x     5x 5x   3x  
export enum ConnectionErrorCode {
  ER_CONN_MAX_CONNECTION = "ER_CONN_MAX_CONNECTION",
  ER_CONN_NO_AVAILABLE = "ER_CONN_NO_AVAILABLE",
  ER_CONN_TIMEOUT = "ER_CONN_TIMEOUT",
  ER_CONN_NOT_OPEN = "ER_CONN_NOT_OPEN",
  ER_CONN_CLOSED = "ER_CONN_CLOSED",
  ER_CONN_SOCKET_NOT_FOUND = "ER_CONN_SOCKET_NOT_FOUND",
}
 
// extend enum using "extends" keyword
export const ErrorCode = {
  ...ConnectionErrorCode,
};
 
export class ConnectionError extends Error {
  public code: ConnectionErrorCode;
  constructor(message: string, code: ConnectionErrorCode) {
    super(message);
    this.code = code;
  }
}