Failing in a shape callers can readintermediate
A raw exception string tells the caller nothing they can act on; RFC 7807 ProblemDetails gives every failure the same machine-readable shape.
Two failure paths, two string messages, and nothing a caller can branch on without matching the prose. Give errors a machine-readable code and a context object — and make sure a token handed to you never survives into what gets logged.
See alsoThe concurrency tokenThe C# version: a domain error carrying what the value is now, rather than the ORM exception.
A caller can branch on a code, and nothing sensitive is in what gets logged.
Published in full, before you start — every point is one of these and there is nothing else. Each one runs your code; it is not a search for keywords.
A raw exception string tells the caller nothing they can act on; RFC 7807 ProblemDetails gives every failure the same machine-readable shape.
Network calls fail. Code that assumes they succeed turns a slow connection into a blank screen with no explanation.