LeXtract.Error.Invalid.Format exception (lextract v0.1.2)

View Source

Error for unknown or invalid format types.

Raised when a format string doesn't match supported formats (json, yaml).

Examples

iex> error = LeXtract.Error.Invalid.Format.exception(format_string: "xml")
iex> Exception.message(error)
"Unknown format type: xml"

iex> error = LeXtract.Error.Invalid.Format.exception(
...>   format_string: "xml",
...>   reason: "Only JSON and YAML are supported"
...> )
iex> String.contains?(Exception.message(error), "Only JSON and YAML")
true

Summary

Functions

Formats the error message for format type errors.

Types

t()

@type t() :: %LeXtract.Error.Invalid.Format{
  __exception__: true,
  bread_crumbs: term(),
  class: term(),
  format_string: String.t(),
  path: term(),
  reason: String.t() | nil,
  splode: term(),
  stacktrace: term(),
  vars: term()
}

Functions

exception(args)

@spec exception(opts :: Keyword.t()) :: %LeXtract.Error.Invalid.Format{
  __exception__: true,
  bread_crumbs: term(),
  class: term(),
  format_string: term(),
  path: term(),
  reason: term(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}

Create an Elixir.LeXtract.Error.Invalid.Format without raising it.

Keys

  • :format_string
  • :reason

message(exception)

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

Formats the error message for format type errors.