import { HttpException, HttpStatus } from '@nestjs/common';

export class VfaxException extends HttpException {
  constructor(
    objectOrError?: string | object | any,
    descriptionOrOptions: string = 'vFax Response Error',
  ) {
    const { description, httpExceptionOptions } =
      HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);

    super(
      HttpException.createBody(
        objectOrError,
        description!,
        HttpStatus.INTERNAL_SERVER_ERROR,
      ),
      HttpStatus.INTERNAL_SERVER_ERROR,
      httpExceptionOptions,
    );
  }
}
