# `PactEx.Error`
[🔗](https://github.com/arctarus/pact_ex/blob/v0.1.0/lib/pact_ex/error.ex#L1)

An error raised or returned by the native Pact library, or by `PactEx`
while preparing input for it.

Fields:

  * `:function` - the `pactffi_*` function that failed, or the `PactEx`
    function that rejected the input.
  * `:code` - the numeric error code. `-100` means an argument contained a
    NUL byte. `-101` means `PactEx` rejected an interaction before calling
    the native library, for example a missing request or an unsupported
    value type.
  * `:message` - a description of the failure.

# `t`

```elixir
@type t() :: %PactEx.Error{
  __exception__: true,
  code: integer(),
  function: String.t(),
  message: String.t()
}
```

# `from_native`

```elixir
@spec from_native(%{function: String.t(), code: integer(), message: String.t()}) ::
  t()
```

Builds an error from the map a native function returns.

Raises `FunctionClauseError` if the map lacks `:function`, `:code` or `:message`.

---

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