Created
March 27, 2025 18:34
-
-
Save Vatsalya-singhi/c200faf5d2856d0a8560fdaccf88b865 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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