# Penanganan Error (Node.js / NestJS) > Exception filters, custom exceptions, HTTP exceptions, respons error, logging - 20 pertanyaan wawancara - Junior - [Pertanyaan Wawancara: Node.js / NestJS](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara.md) ## 1. Apa itu exception filter di NestJS? **Jawaban** Exception filter adalah komponen NestJS yang mencegat exception yang dilempar dalam aplikasi dan mengubahnya menjadi respons HTTP yang sesuai. Ia memusatkan penanganan error dan menghindari duplikasi kode dengan menerapkan logika umum pada semua exception. Filter dapat bersifat global, diterapkan pada controller tertentu, atau pada route tertentu sesuai kebutuhan. ## 2. Kelas NestJS mana yang harus digunakan untuk mengembalikan error HTTP 404? **Jawaban** NotFoundException adalah kelas standar NestJS untuk mengembalikan error 404 (Not Found). Ia mewarisi HttpException dan secara otomatis mengonfigurasi kode status HTTP yang sesuai. Exception ini ideal ketika resource yang diminta tidak ada di basis data. NestJS menyediakan kelas khusus untuk setiap jenis error HTTP umum guna menyederhanakan pengembangan. ## 3. Bagaimana cara membuat HttpException kustom di NestJS? **Jawaban** Untuk membuat exception kustom, Anda perlu memperluas kelas HttpException dengan memanggil super menggunakan pesan error dan kode status HTTP. Pendekatan ini memungkinkan pendefinisian exception bisnis spesifik untuk aplikasi sambil tetap menghormati konvensi NestJS. Exception kustom memudahkan pemeliharaan dan membuat kode lebih ekspresif dengan memberikan nama yang bermakna untuk berbagai situasi error. ## 17 pertanyaan lagi tersedia - Di mana menempatkan decorator @Catch untuk exception filter global? - Metode mana yang harus diimplementasikan dalam exception filter kustom? Daftar gratis: https://sharpskill.dev/id/login ## Topik wawancara Node.js / NestJS lainnya - [Dasar-Dasar Node.js](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/nodejs-fundamentals.md): 20 pertanyaan, Junior - [API Inti Node.js](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/nodejs-core-apis.md): 25 pertanyaan, Junior - [Pemrograman Asinkron](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/asynchronous-programming.md): 25 pertanyaan, Junior - [Dasar-Dasar Express.js](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/express-basics.md): 20 pertanyaan, Junior - [Dasar-Dasar NestJS](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/nestjs-fundamentals.md): 23 pertanyaan, Junior - [Desain API REST](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/rest-api-design.md): 20 pertanyaan, Junior - [Validasi & DTO](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/validation-dto.md): 20 pertanyaan, Junior - [Dokumentasi API & Kontrak](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/api-documentation.md): 20 pertanyaan, Junior - [Pengujian Unit](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/testing-unit.md): 20 pertanyaan, Junior - [Penjadwalan Tugas](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/scheduling-cron.md): 15 pertanyaan, Junior - [Modul dan DI NestJS](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/nestjs-modules-di.md): 20 pertanyaan, Mid-Level - [Konfigurasi & Manajemen Lingkungan](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/configuration-environment.md): 20 pertanyaan, Mid-Level - [Autentikasi JWT](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/authentication-jwt.md): 25 pertanyaan, Mid-Level - [Otorisasi & RBAC](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/authorization-rbac.md): 20 pertanyaan, Mid-Level - [Database dengan TypeORM](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/database-typeorm.md): 30 pertanyaan, Mid-Level - [Prisma ORM](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/prisma-orm.md): 25 pertanyaan, Mid-Level - [Middleware dan Interceptor](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/middleware-interceptors.md): 20 pertanyaan, Mid-Level - [Unggah file](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/file-upload.md): 15 pertanyaan, Mid-Level - [WebSockets](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/websockets.md): 20 pertanyaan, Mid-Level - [GraphQL dengan NestJS](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/graphql-basics.md): 25 pertanyaan, Mid-Level - [Pengujian End-to-End](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/testing-e2e.md): 20 pertanyaan, Mid-Level - [Caching dengan Redis](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/caching-redis.md): 20 pertanyaan, Mid-Level - [Antrian dengan Bull](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/queues-bull.md): 20 pertanyaan, Mid-Level - [DevOps, Logging & CI/CD](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/logging-monitoring.md): 25 pertanyaan, Mid-Level - [Docker & Kontainerisasi](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/docker-containerization.md): 25 pertanyaan, Mid-Level - [Microservices](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/microservices.md): 30 pertanyaan, Senior - [Praktik Terbaik Keamanan](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/security-best-practices.md): 25 pertanyaan, Senior - [Performa dan Deployment Cloud](https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/performance-optimization.md): 30 pertanyaan, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/id/technologies/node-nestjs/pertanyaan-wawancara/error-handling