# `LeXtract.Error.Processing.Parsing`
[🔗](https://github.com/YgorCastor/lextract.git/blob/main/lib/lextract/error/processing/parsing.ex#L1)

Error for JSON/YAML parsing failures.

Raised when text cannot be parsed in the expected format.

## Examples

    iex> error = LeXtract.Error.Processing.Parsing.exception(
    ...>   format: :json,
    ...>   reason: "unexpected token at position 5"
    ...> )
    iex> String.contains?(Exception.message(error), "JSON")
    true

    iex> error = LeXtract.Error.Processing.Parsing.exception(
    ...>   format: :yaml,
    ...>   reason: "invalid indentation",
    ...>   content_sample: "key:value\n  bad"
    ...> )
    iex> String.contains?(Exception.message(error), "YAML")
    true

# `t`

```elixir
@type t() :: %LeXtract.Error.Processing.Parsing{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  content_sample: String.t() | nil,
  format: :json | :yaml,
  path: term(),
  reason: String.t(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}
```

# `exception`

```elixir
@spec exception(opts :: Keyword.t()) :: %LeXtract.Error.Processing.Parsing{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  content_sample: term(),
  format: term(),
  path: term(),
  reason: term(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}
```

Create an `Elixir.LeXtract.Error.Processing.Parsing` without raising it.

## Keys

- :format
- :reason
- :content_sample

# `message`

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

Formats the error message for parsing failures.

---

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