The lost updateadvanced
When two people edit the same record and both save, the second write silently erases the first unless it carries the version it was based on — and there is no error, no log and nothing to find afterwards.
Two people reserve the last unit of stock within a second of each other and both succeed. Give the row a version, let the second write fail, and turn that failure into something the caller can act on.
AssumesThe Lost UpdateThe lost update, taught in JavaScript first. This stage is the same race with a row version on it.
See also“Something went wrong”The JavaScript version: an error class with a code and a redacted context, graded by running it.
The second writer fails loudly, and the failure says what the value is now.
Published in full, before you start — every point is one of these and there is nothing else.
When two people edit the same record and both save, the second write silently erases the first unless it carries the version it was based on — and there is no error, no log and nothing to find afterwards.
A raw exception string tells the caller nothing they can act on; RFC 7807 ProblemDetails gives every failure the same machine-readable shape.