All files / src errors.ts

100% Statements 10/10
100% Branches 0/0
100% Functions 2/2
100% Lines 10/10

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 22 23 242x 2x   2x 2x     16x 16x           2x       12x 12x 12x      
import { SUPPORTED_PROTOCOLS } from './const'
import { stripEnd } from './utils'
 
export class InvalidProtocolError extends Error {
  private static supportedProtocols = SUPPORTED_PROTOCOLS.map(stripEnd).join(', ')
 
  constructor(protocol: string) {
    super(`Invalid protocol: ${protocol}. Supported protocols are: ${InvalidProtocolError.supportedProtocols}`)
    this.name = 'InvalidProtocolError'
  }
}
 
export type InvalidPatternErrorCode = 'ERR_QUERY_STRING' | 'ERR_INFIX_WILDCARD' | 'ERR_INVALID_URL'
 
export class InvalidPatternError extends Error {
  readonly code: InvalidPatternErrorCode
 
  constructor(message: string, code: InvalidPatternErrorCode) {
    super(`${code}: ${message}`)
    this.code = code
    this.name = 'InvalidPatternError'
  }
}