Coelho.Document.Error (coelho v0.2.0)

Copy Markdown View Source

A single validation failure, located in the document tree.

The :path is a list of segments from the root: string keys for map fields, integers for positions inside content.

Summary

Functions

Renders an error as content[0].attrs.href: message.

Renders a path as content[0].attrs.href, or "" for the document itself.

Types

segment()

@type segment() :: String.t() | non_neg_integer()

t()

@type t() :: %Coelho.Document.Error{message: String.t(), path: [segment()]}

Functions

format(error)

@spec format(t()) :: String.t()

Renders an error as content[0].attrs.href: message.

format_path(path)

@spec format_path([segment()]) :: String.t()

Renders a path as content[0].attrs.href, or "" for the document itself.