Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vatsalya-singhi/c200faf5d2856d0a8560fdaccf88b865 to your computer and use it in GitHub Desktop.
Save Vatsalya-singhi/c200faf5d2856d0a8560fdaccf88b865 to your computer and use it in GitHub Desktop.
import { Controller, Get, UseFilters, HttpException, HttpStatus } from '@nestjs/common';
import { HttpExceptionFilter } from './http-exception.filter';
@Controller('users')
@UseFilters(HttpExceptionFilter) // Apply to all methods in this controller
export class UsersController {
@Get()
findAll() {
throw new HttpException('Users not found', HttpStatus.NOT_FOUND);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment