All files / src/Program/errors MissingProgramOption.ts

71.42% Statements 5/7
50% Branches 2/4
50% Functions 1/2
71.42% Lines 5/7

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 1644x   44x   8x 8x       44x            
import { CustomError } from 'ts-custom-error';
 
export class MissingProgramOption<ServiceNames, OptionsType> extends CustomError {
  public constructor(service: ServiceNames, option: OptionsType | OptionsType[]) {
    super();
    this.message = `${service} requires the ${Array.isArray(option) ? option.join(' or ') : option} program option.`;
  }
}
 
export class InvalidProgramOption<OptionsType> extends CustomError {
  public constructor(option: OptionsType | OptionsType[]) {
    super();
    this.message = `Invalid program option: ${Array.isArray(option) ? option.join(' or ') : option}.`;
  }
}