Implement centralized exception handling and validation

- Add custom exception classes for structured error handling
- Implement global exception handlers in FastAPI application
- Add comprehensive request/response validation
- Create exception contract tests for validation
- Update backend development documentation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-04-27 18:52:12 +02:00
parent 2e221f6852
commit afc1e44e99
5 changed files with 500 additions and 98 deletions

View File

@@ -1,22 +1,3 @@
## 4) Module-level mutable runtime flags in service layer
- Where found:
- [backend/app/services/jail_service.py](backend/app/services/jail_service.py)
- Why this is needed:
- Global mutable state is difficult to reason about under concurrency and tests.
- Goal:
- Move mutable runtime state to managed app/runtime state services.
- What to do:
- Replace module-level flags with injected state holder.
- Guard mutations with clear synchronization boundaries.
- Possible traps and issues:
- Race conditions can reappear if state updates are spread across modules.
- Docs changes needed:
- Document allowed mutable-state locations.
- Doc references:
- [Docs/Architekture.md](Docs/Architekture.md)
---
## 5) Inconsistent domain exception contracts across services
- Where found:
- [backend/app/routers/jails.py](backend/app/routers/jails.py)