# `Localize.DateTimeParseError`
[🔗](https://github.com/elixir-localize/localize/blob/v1.4.0/lib/localize/exception/date_time_parse_error.ex#L1)

Returned (or raised) when an input string cannot be interpreted as a
date, a time, a datetime or a date range.

`Localize.DateTime.parse/2` returns it with `:attempts` unset.
`Localize.DateTime.Parser.parse/2`, which tries each shape in turn,
populates `:attempts` with what every sub-parser reported.

Carries semantic fields only; the human-readable description is
materialised by `message/1` so callers can pattern-match on
structure (input/locale) without parsing prose.

### Fields

* `:input` — the raw string that failed to parse.

* `:locale` — the locale the parser tried.

* `:attempts` — a keyword list of `{kind, exception}` recording each
  sub-parser that was tried and the exception it returned, in the
  order they were attempted. `kind` is one of `:interval`, `:date`,
  `:time` or `:datetime`. `nil` when a single shape was parsed.

# `attempt`

```elixir
@type attempt() :: {kind(), Exception.t()}
```

# `kind`

```elixir
@type kind() :: :interval | :date | :time | :datetime
```

# `t`

```elixir
@type t() :: %Localize.DateTimeParseError{
  __exception__: term(),
  attempts: [attempt()] | nil,
  input: String.t() | nil,
  locale: atom() | String.t() | nil
}
```

---

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