# `Tinkex.Error`
[🔗](https://github.com/North-Shore-AI/tinkex/blob/v0.4.0/lib/tinkex/error.ex#L1)

Error type for Tinkex operations.

Mirrors Python tinker error handling with categorization for retry logic.

# `error_type`

```elixir
@type error_type() ::
  :api_connection | :api_timeout | :api_status | :request_failed | :validation
```

# `t`

```elixir
@type t() :: %Tinkex.Error{
  category: Tinkex.Types.RequestErrorCategory.t() | nil,
  data: map() | nil,
  message: String.t(),
  retry_after_ms: non_neg_integer() | nil,
  status: integer() | nil,
  type: error_type()
}
```

# `format`

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

Format error as string.

# `from_response`

```elixir
@spec from_response(integer(), map()) :: t()
```

Create an error from an HTTP response.

# `new`

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

Create a new error.

# `retryable?`

```elixir
@spec retryable?(t()) :: boolean()
```

Check if error is retryable.

# `user_error?`

```elixir
@spec user_error?(t()) :: boolean()
```

Check if error is a user error (not retryable).

Truth table:
- category == :user → YES
- status 4xx (except 408, 429) → YES
- Everything else → NO

---

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