# `Snakepit.Error.Parser`
[🔗](https://github.com/nshkrdotcom/snakepit/blob/v0.13.0/lib/snakepit/error/parser.ex#L1)

Parses Python exception data into structured Elixir errors.

Automatically detects error patterns (OOM, shape mismatch, device errors)
and creates appropriate structured exceptions.

# `extract_shape`

```elixir
@spec extract_shape(String.t()) :: [integer()] | nil
```

Extracts a shape from a string representation.

## Examples

    iex> Parser.extract_shape("[3, 224, 224]")
    [3, 224, 224]

    iex> Parser.extract_shape("(10, 20)")
    [10, 20]

# `from_grpc_error`

```elixir
@spec from_grpc_error(map()) :: {:ok, Exception.t()} | {:error, :invalid_input}
```

Parses a gRPC error response into a structured error.

# `parse`

```elixir
@spec parse(map() | term()) :: {:ok, Exception.t()} | {:error, :invalid_input}
```

Parses error data into a structured error.

Accepts a map with "type", "message", and optionally "traceback".

## Examples

    {:ok, error} = Parser.parse(%{
      "type" => "ValueError",
      "message" => "Invalid input"
    })

---

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