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.
A payout service where the one line that moves money is indented five times. Flatten it — and decide, while you are there, which of these five conditions is a bug and which is a business outcome.
See alsoThe pyramid in the middle of the functionThe same pyramid in JavaScript, where the four error responses are checked by running them.
A caller can tell a defect from a refusal, and the transfer is readable in one pass.
Published in full, before you start — every point is one of these and there is nothing else.
A raw exception string tells the caller nothing they can act on; RFC 7807 ProblemDetails gives every failure the same machine-readable shape.
A vertical slice keeps one feature — its endpoint, its validation, its data access — in one folder, so changing checkout means opening one place instead of four layers.