exception-handling
Installation
SKILL.md
Exception Handling
Use this skill when defining API error contracts and mapping domain failures to HTTP responses.
Workflow
- Define domain exceptions for expected failure classes.
- Map exceptions to Litestar handlers globally or by scope.
- Return consistent error payload shapes.
- Log with enough context for debugging without leaking sensitive details.
Pattern
from litestar import Litestar, Request
from litestar.response import Response