How do you handle Errors in Clean Architecture?

Updated Apr 28, 2026

Short answer

Define domain-specific errors in the core and translate them to external formats (like HTTP status) in the adapter layer.

Deep explanation

Errors are part of the business logic. We create custom Error classes in the Domain or Use Case layer (e.g., InsufficientFundsError). The Use Case throws these. The Controller catches them and uses a 'Map' to return a 400 or 403 status code.

Real-world example

A 'SeatAlreadyTaken' error in a booking system that results in a 409 Conflict in a REST API.

Common mistakes

  • Throwing 'new Error('Not Found')' directly and checking the string message in the UI.

Follow-up questions

  • What is the Notification Pattern for errors?

More Clean Architecture interview questions

View all →