Macaw.Draw.Error exception (macaw_draw v0.1.0)

Copy Markdown View Source

The exception every Macaw.Draw ! twin raises (spec/06 §1.2).

A twin raises exactly where its value twin answers {:error, faults}, and carries those faults on :reason unchanged, so a test asserts the terms without parsing words. The message words each fault with Macaw.Base.Fault.format/2 and layers' words for layers' own reasons (Macaw.Layers.Words), its empty path named argument:

iex> error = Macaw.Draw.Error.exception(reason: [{[0], {:not_positive, 0}}])
iex> {error.reason, Exception.message(error)}
{[{[0], {:not_positive, 0}}], "[0]: {:not_positive, 0}"}

Summary

Types

t()

@type t() :: %Macaw.Draw.Error{
  __exception__: term(),
  message: String.t(),
  reason: [Macaw.Base.Fault.t()]
}