HttpException is the base exception class in NestJS, exported from @nestjs/common. It takes a response (string or object for the JSON body) and a status (HTTP status code, typically from the HttpStatus enum). An optional third options parameter provides cause for error chaining.

throw new HttpException('Forbidden', HttpStatus.FORBIDDEN);
throw new HttpException({ status: 403, error: 'Custom message' }, HttpStatus.FORBIDDEN, { cause: error });

Nest provides built-in subclasses: BadRequestException, NotFoundException, ForbiddenException, UnauthorizedException, InternalServerErrorException, and more. These all inherit from IntrinsicException and are suppressed from console logging by default.