v2.14.3 — Repo.transaction/1 changeset error handling docs
Patch release: document the Repo.transaction/1 changeset error-handling
footgun in the ecto-patterns skill (issue #76, proposed by @ndrean).
Added
ecto-patterns:Repo.transaction/1changeset error handling — new
reference section (and an anti-pattern row in the auto-loaded SKILL.md) on the
bare-match footgun insideRepo.transaction(fn -> ... end):{:ok, _} = Repo.update(cs)raisesMatchErroron an invalid changeset, which rolls back
and re-raises (crashing the caller, e.g. a500) — it does not return
{:error, %MatchError{}}. Documents the explicitcase+Repo.rollback/1
fix (single step) and thewith ... elsefix (multi-step), and points to
Repo.transact/1/Ecto.Multias the footgun-free forms. Verified
empirically on Ecto 3.14. Thanks to @ndrean for the proposal (#76).