Macaw.Data.Fault (macaw_data v0.21.1)
View SourceThe library's words for its own fault reasons (spec/00 §5), given to the family's one
formatter, Macaw.Base.Fault (macaw_base spec/01 §3), as words:.
A reason is a list of faults, {path, reason} each, or one bare reason, and
Macaw.Base.Fault.sentence/2 words it: a fault as path: words, the empty path named
by root: ("value" by default), the faults of a list joined by "; ". The words come
from the caller's words: in order, then the family's general words, then the term:
iex> Macaw.Base.Fault.sentence(
...> [{[:temp], {:length, 3}}, {[:at, 1], {:type, :time}}],
...> words: [&Macaw.Data.Fault.words/1]
...> )
"temp: must hold 3 values, as the first column does; at[1]: must be a time: a DateTime, a NaiveDateTime or a Date"
iex> Macaw.Base.Fault.sentence([{[], {:rank, 3}}], root: "source", words: &Macaw.Data.Fault.words/1)
"source: is a tensor of rank 3; a source's tensor has rank 1 or 2"So a reason reads one way whichever function answered it. A module with words of its
own gives them first, words: [&own/1, &Macaw.Data.Fault.words/1]. Because the
library's words come before the general ones, its :unknown_key, :not_data and
{:type, :time} read in its own terms.
Summary
Functions
The words of a reason in the library's vocabulary, nil for a reason it does not word.