Complete the code to throw a 404 Not Found exception in a NestJS controller.
throw new [1]();The NotFoundException is used to throw a 404 error in NestJS.
Complete the code to import the built-in HTTP exceptions from NestJS.
import { [1] } from '@nestjs/common';
The HttpException class is the base for all built-in HTTP exceptions in NestJS.
Fix the error in throwing a 400 Bad Request exception with a custom message.
throw new [1]('Invalid input');
The BadRequestException is used to indicate a 400 error with a custom message.
Fill both blanks to throw a 403 Forbidden exception with a custom message.
throw new [1]('[2]');
The ForbiddenException throws a 403 error. The message can be any string, here we use 'Unauthorized'.
Fill all three blanks to throw a 401 Unauthorized exception with a custom message and import it correctly.
import { [1] } from '@nestjs/common'; throw new [2]('[3]');
Import and throw UnauthorizedException with a message like 'Bad credentials' to indicate a 401 error.