# `TypeSafeSDK.Error`
[🔗](https://github.com/nshkrdotcom/typesafe_sdk/blob/v0.4.0/lib/typesafe_sdk/error.ex#L1)

Normalized TypeSafe SDK error.

HTTP status mapping follows the supplied Python SDK: 400, 401, 403, 404, 422,
429, and 5xx receive dedicated `type` values; other unsuccessful statuses use
`:api_error`. Transport and response validation failures are distinct.

# `error_type`

```elixir
@type error_type() ::
  :invalid_request
  | :task_exit
  | :runtime_capability
  | :configuration
  | :bad_request
  | :authentication
  | :permission_denied
  | :not_found
  | :unprocessable_entity
  | :rate_limit
  | :internal_server
  | :api_error
  | :connection
  | :timeout
  | :cancelled
  | :response_contract
  | :request_too_large
  | :model_not_found
  | :ambiguous_model
  | :unordered_model_catalog
  | :response_validation
```

# `t`

```elixir
@type t() :: %TypeSafeSDK.Error{
  __exception__: true,
  body: term(),
  cause: term(),
  details: map(),
  endpoint: String.t() | nil,
  field_path: String.t() | nil,
  headers: map(),
  message: String.t(),
  path: [String.t()] | nil,
  prepared_fingerprint: String.t() | nil,
  raw_http_response: Pristine.Response.t() | nil,
  request_id: String.t() | nil,
  retry_after_ms: non_neg_integer() | nil,
  status: integer() | nil,
  type: error_type()
}
```

# `configuration`

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

# `extract_message`

```elixir
@spec extract_message(term()) :: String.t() | nil
```

# `invalid_request`

```elixir
@spec invalid_request([String.t()], String.t(), map()) :: t()
```

A local request validation failure, with unambiguous path components.

# `metadata`

```elixir
@spec metadata(t()) :: map()
```

Stable, bounded structural metadata safe for telemetry and diagnostics.

# `parse_retry_after`

```elixir
@spec parse_retry_after(map() | list()) :: non_neg_integer() | nil
```

# `response_validation`

```elixir
@spec response_validation(String.t() | [String.t()], term()) :: t()
```

# `retry_after`

```elixir
@spec retry_after(t()) :: non_neg_integer() | nil
```

Retry-After advice in milliseconds, when supplied by the service.

# `retryable?`

```elixir
@spec retryable?(t(), TypeSafeSDK.RetryPolicy.t() | false) :: boolean()
```

Whether the error is eligible under the given retry policy (default: SDK default).

---

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