# `ExMCP.Transport.SecurityError`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/transport/security_error.ex#L1)

Standardized security error handling across transports.

This module provides consistent error formatting and handling
for security violations across all MCP transports.

# `error_type`

```elixir
@type error_type() ::
  :token_passthrough_blocked
  | :consent_required
  | :consent_denied
  | :consent_error
  | :security_violation
```

# `t`

```elixir
@type t() :: %ExMCP.Transport.SecurityError{
  details: map(),
  message: String.t(),
  timestamp: DateTime.t(),
  type: atom()
}
```

# `format_for_transport`

```elixir
@spec format_for_transport(t(), atom()) :: term()
```

Formats a security error for a specific transport.

Different transports may need different error formats:
- HTTP: Status codes and JSON responses
- Stdio: JSON-RPC error format
- BEAM: Elixir error tuples

# `new`

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

Creates a new security error.

## Parameters

- `type` - The type of security violation
- `message` - Human-readable error message
- `details` - Additional context about the error

## Examples

    error = SecurityError.new(:consent_required,
      "User consent required",
      %{url: "https://api.example.com", user_id: "user123"}
    )

# `security_error?`

```elixir
@spec security_error?(term()) :: boolean()
```

Checks if an error is a security-related error.

# `to_error_tuple`

```elixir
@spec to_error_tuple(t()) :: {:error, term()}
```

Converts a security error to a standard Elixir error tuple.

---

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