Microdata v0.2.4 Microdata.Error exception View Source

Microdata.Error provides a generic error struct implementing the Exception behaviour and containing three keys: type, reason, and metadata.

  • type is an atom classifying the general context the error exists in, such as :document.
  • reason is an atom classifying the general problem, such as :no_items.
  • metadata is a map containing any additional information useful for debugging the error, such as %{input: "..."}.

Microdata Errors:

  • %Microdata.Error{type: :document, reason: :no_items}

Link to this section Summary

Functions

Lists a mapping of error types to reasons for all possible Microdata errors

Creates a new %Microdata.Error{}

Link to this section Types

Link to this type metadata() View Source
metadata() :: %{optional(any()) => any()}
Link to this type t() View Source
t() :: %Microdata.Error{
  __exception__: term(),
  metadata: metadata(),
  reason: reason(),
  type: type()
}

Link to this section Functions

Link to this function list_errors() View Source
list_errors() :: %{optional(type()) => [reason()]}

Lists a mapping of error types to reasons for all possible Microdata errors.

Link to this function new(type, reason, metadata \\ %{}) View Source
new(type(), reason(), metadata()) :: t()

Creates a new %Microdata.Error{}.