Errors that belong to the domain, not to the plumbing.
The distinction matters. A DomainError means "the business refuses this" —
it is a legitimate, expected outcome that the ubiquitous language has a word
for. A TypeError means "the programmer made a mistake". Never conflate them:
the first is part of the model and should be readable by a domain expert; the
second is a bug.
Errors that belong to the domain, not to the plumbing.
The distinction matters. A
DomainErrormeans "the business refuses this" — it is a legitimate, expected outcome that the ubiquitous language has a word for. ATypeErrormeans "the programmer made a mistake". Never conflate them: the first is part of the model and should be readable by a domain expert; the second is a bug.