ASDF.Warning (asdf v0.1.0)

Copy Markdown View Source

A recovery this library records in :permissive mode.

The same input in :strict mode returns {:error, %ASDF.Error{}} and produces no warning. reason matches the error reason the strict path would have used, such as :duplicate_key.

Examples

iex> yaml = "%YAML 1.1\n---\na: 1\na: 2\n...\n"
...> {:ok, %{"a" => 2}, [warning]} = ASDF.YAML.parse(yaml, mode: :permissive)
...> {warning.reason, warning.message}
{:duplicate_key, "duplicate mapping key \"a\"; kept the last value"}

Summary

Types

t()

One recovery.

Types

t()

@type t() :: %ASDF.Warning{
  line: pos_integer() | nil,
  message: String.t(),
  offset: non_neg_integer() | nil,
  reason: atom()
}

One recovery.

  • :reason — stable atom, the same atom strict mode would return
  • :message — short description of what was kept
  • :line — one-based line, or nil when the parser has no line
  • :offset — zero-based byte index, or nil