A service or domain layer should not think about the HTTP response format. It only reports that a business rule has been violated. Then the Exception Handler decides which HTTP status code and which ...
This enables post-hoc debugging of bad responses and root cause analysis. Why it matters for AI: Debugging an AI response requires knowing what the model saw (the prompt with retrieved context), not ...