# `Hermolaos.Error`
[🔗](https://github.com/nyo16/hermolaos/blob/v0.5.0/lib/hermolaos/error.ex#L1)

Exception struct for MCP/JSON-RPC errors.

This exception can be raised when an MCP operation fails with an error
response from the server or a client-side error occurs.

## Examples

    try do
      result = Hermolaos.call_tool(client, "unknown_tool", %{})
    rescue
      e in Hermolaos.Error ->
        IO.puts("Tool call failed: #{e.message}")
        IO.puts("Error code: #{e.code}")
    end

# `t`

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

# `new`

```elixir
@spec new(integer(), String.t(), term()) :: t()
```

Creates a new Hermolaos.Error from components.

## Examples

    iex> Hermolaos.Error.new(-32601, "Method not found")
    %Hermolaos.Error{code: -32601, message: "Method not found", data: nil}

---

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