Pote.Error exception (Pote v3.0.0)

Copy Markdown View Source

Typed error returned by Pote APIs that parse or validate structured input (currently theme JSON loading).

Unlike raising functions (parse!/1), the fallible variants (parse/1, load_json/1) return {:error, %Pote.Error{}} so callers can pattern-match on kind without string matching.

Fields

  • kind - atom category of the error (:invalid_theme, ...)
  • message - human-readable explanation
  • details - optional extra context (e.g. the offending key)

Examples

iex> {:error, %Pote.Error{kind: :invalid_theme}} = Pote.Theme.parse("{bad json")
true

Summary

Types

t()

@type t() :: %Pote.Error{
  __exception__: true,
  details: term(),
  kind: atom(),
  message: String.t()
}