Error handling
Обработка ошибок в Spring-приложении простыми словами: модель ошибок (доменные vs технические), единый обработчик @RestControllerAdvice и типичные грабли с исключениями.
A compact section on error handling in a backend application: how to structure the error model, gather handling in one place, and avoid the typical pitfalls with exceptions. It complements the discussion of REST errors (Problem Details) and resilience.
- The application error model — Domain errors and technical failures — what the difference is, why you need typed exceptions, and how they reach the client in Spring Boot.
- A single error handler — How @RestControllerAdvice and @ExceptionHandler turn exceptions into HTTP responses from one place — without a try/catch in every controller. Mapping domain exceptions and logging.
- Typical mistakes in exception handling — A swallowed catch, a lost stack trace, exceptions as flow control, a swallowed InterruptedException, duplicated logs — how to avoid them and what to do instead.