
Error Handling
Exception filters, custom exceptions, HTTP exceptions, error responses, logging
1What is an exception filter in NestJS?
What is an exception filter in NestJS?
Cevap
An exception filter is a NestJS component that intercepts exceptions thrown in the application and transforms them into appropriate HTTP responses. It centralizes error handling and avoids code duplication by applying common logic to all exceptions. Filters can be global, applied to a specific controller, or to a particular route depending on the needs.
2Which NestJS class should be used to return an HTTP 404 error?
Which NestJS class should be used to return an HTTP 404 error?
Cevap
NotFoundException is the standard NestJS class for returning a 404 (Not Found) error. It inherits from HttpException and automatically configures the appropriate HTTP status code. This exception is ideal when a requested resource does not exist in the database. NestJS provides dedicated classes for each common HTTP error type to simplify development.
3How to create a custom HttpException in NestJS?
How to create a custom HttpException in NestJS?
Cevap
To create a custom exception, extend the HttpException class by calling super with the error message and HTTP status code. This approach allows defining business-specific exceptions for the application while respecting NestJS conventions. Custom exceptions facilitate maintenance and make code more expressive by giving meaningful names to different error situations.
Where to place the @Catch decorator for a global exception filter?
Which method must be implemented in a custom exception filter?
+17 mülakat soruları
Diğer Node.js / NestJS mülakat konuları
Node.js Fundamentals
Node.js Core APIs
Asynchronous Programming
Express.js Basics
NestJS Fundamentals
REST API Design
Validation & DTO
API Documentation & Contracts
Unit Testing
Task Scheduling
NestJS Modules & DI
Configuration & Environment Management
JWT Authentication
Authorization & RBAC
Database with TypeORM
Prisma ORM
Middleware & Interceptors
File Upload
WebSockets
GraphQL with NestJS
End-to-End Testing
Caching with Redis
Queues with Bull
DevOps, Logging & CI/CD
Docker & Containerization
Microservices
Security Best Practices
Performance & Cloud Deployment
Bir sonraki mülakatın için Node.js / NestJS'de uzmanlaş
Tüm sorulara, flashcards'a, teknik testlere, code review alıştırmalarına ve mülakat simülatörlerine eriş.
Ücretsiz başla