# `LeXtract.Error.Invalid.Format`
[🔗](https://github.com/YgorCastor/lextract.git/blob/main/lib/lextract/error/invalid/format.ex#L1)

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

# `t`

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

# `exception`

```elixir
@spec exception(opts :: Keyword.t()) :: %LeXtract.Error.Invalid.Format{
  __exception__: term(),
  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`

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

Formats the error message for format type errors.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
