# Centralized error handling

A step of the [Cloud application](https://gradus.kazet.blog/tree/cloud-application) tree on Gradus, in the Testing & resilience area: Tests, errors, SLOs.

Page: https://gradus.kazet.blog/tree/cloud-application/step/error-handling

Introduce typed errors and a centralized handler so failures are caught, logged and turned into consistent responses.

Usually comes after: [Unit tests](https://gradus.kazet.blog/tree/cloud-application/step/unit-tests).

Leads to: [Retries & circuit breakers](https://gradus.kazet.blog/tree/cloud-application/step/retries-and-circuit-breakers).

## Prompt for your AI assistant

```
Introduce a typed error hierarchy and a centralized error-handling middleware that catches unhandled exceptions and returns consistent, well-formed error responses.
```

Every step of the tree: https://gradus.kazet.blog/tree/cloud-application/llms.txt
