All files / app/errors/car max-car-amount-reached-error.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

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 241x           1x                     3x     3x      
import BadRequestError from '../bad-request-error';
 
/**
 * This error is thrown if user tries to add a car to a group which
 * has already reached to maximal car amount.
 */
export class MaxCarAmountReachedError extends BadRequestError {
  /**
   * The reached amount of cars.
   */
  public amount!: number;
 
  /**
   * Creates an instance of this class.
   * @param amount  - The reached amount of cars
   */
  constructor(amount: number) {
    super(`The group has reached the maximum amount of ${amount} cars`,
        {amount});
 
    this.amount = amount;
  }
}