# `Dmn.Error`
[🔗](https://github.com/FeeJai/BDM/blob/dmn-v0.1.0/apps/dmn/lib/dmn/error.ex#L1)

What is wrong with a model, as a value.

Nothing in `dmn` raises for the input it is given: a document that is not XML, a model that breaks the schema, an
import that cannot be found, an expression that does not parse, all come back as `{:error, %Dmn.Error{}}`. It is an exception
too, so `Dmn.load!/2` and the like can raise it.

| Field | Is |
| ----- | -- |
| `kind` | `:xml` (the bytes are not a usable XML document), `:model` (the document is not a DMN model), `:import` (an import cannot be had), `:compile` (the model cannot be compiled), `:run` (a run cannot be done, or ended in `:strict` mode), `:limit` (a bound of `Dmn.Limits` is passed) |
| `code` | an atom that says what, for a program to match on |
| `message` | the text, for a person |
| `element` | the `id` of the element of the model that it is about, if it has one |
| `line` | the line of the document, for `:xml` and `:model` |
| `details` | whatever else is known (the name, the limit, the value) |

# `kind`

```elixir
@type kind() :: :xml | :model | :import | :compile | :run | :limit
```

# `t`

```elixir
@type t() :: %Dmn.Error{
  __exception__: term(),
  code: atom(),
  details: map(),
  element: String.t() | nil,
  kind: kind(),
  line: pos_integer() | nil,
  message: String.t()
}
```

# `new`

```elixir
@spec new(kind(), atom(), String.t(), keyword()) :: t()
```

Makes an error.

    iex> error = Dmn.Error.new(:xml, :doctype_not_allowed, "a DOCTYPE is not read", line: 1)
    iex> {error.kind, error.code, error.line}
    {:xml, :doctype_not_allowed, 1}

---

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