> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manthan.systems/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> The ParmanaError hierarchy — and which of these are actually thrown

## Hierarchy

Every SDK exception extends `ParmanaError` (`typescript/src/errors/ParmanaError.ts`), which carries a stable `code: ErrorCode`, a `message`, and optional `requestId` / `cause`:

```ts theme={null}
enum ErrorCode {
  CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
  VALIDATION_ERROR = "VALIDATION_ERROR",
  AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR",
  AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR",
  EXECUTION_REJECTED = "EXECUTION_REJECTED",
  VERIFICATION_ERROR = "VERIFICATION_ERROR",
  REPLAY_ERROR = "REPLAY_ERROR",
  NETWORK_ERROR = "NETWORK_ERROR",
  TIMEOUT_ERROR = "TIMEOUT_ERROR",
  INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
}
```

| Class                    | `code`                  | File                               |
| ------------------------ | ----------------------- | ---------------------------------- |
| `ConfigurationError`     | `CONFIGURATION_ERROR`   | `errors/ConfigurationError.ts`     |
| `ValidationError`        | `VALIDATION_ERROR`      | `errors/ValidationError.ts`        |
| `AuthenticationError`    | `AUTHENTICATION_ERROR`  | `errors/AuthenticationError.ts`    |
| `AuthorizationError`     | `AUTHORIZATION_ERROR`   | `errors/AuthorizationError.ts`     |
| `ExecutionRejectedError` | `EXECUTION_REJECTED`    | `errors/ExecutionRejectedError.ts` |
| `VerificationError`      | `VERIFICATION_ERROR`    | `errors/VerificationError.ts`      |
| `ReplayError`            | `REPLAY_ERROR`          | `errors/ReplayError.ts`            |
| `NetworkError`           | `NETWORK_ERROR`         | `errors/NetworkError.ts`           |
| `TimeoutError`           | `TIMEOUT_ERROR`         | `errors/TimeoutError.ts`           |
| `InternalServerError`    | `INTERNAL_SERVER_ERROR` | `errors/InternalServerError.ts`    |

<Warning>
  **Most of these are never thrown by the SDK.** Searching `typescript/src` for `throw new` finds exactly three sites:

  * `ParmanaClient`'s constructor throws `ConfigurationError` when `endpoint` or `transport` is missing.
  * `HttpTransport.send` throws `TimeoutError` when the `AbortController` fires.
  * `HttpTransport.send` throws `NetworkError` for any other `fetch` rejection.

  `ValidationError`, `AuthenticationError`, `AuthorizationError`, `ExecutionRejectedError`, `VerificationError`, `ReplayError`, and `InternalServerError` are fully defined, exported, and documented — but nothing in `HttpTransport` or any `*Api` class inspects `response.status` and throws them. `HttpTransport.send` resolves successfully for **any** HTTP status, including 4xx and 5xx: it only special-cases `204` (empty body) and otherwise always calls `response.json()` and returns a `TransportResponse`.

  In practice, if the server returns `{ "error": "Execution Trust Record not found." }` with a `404`, `client.replay(id)` resolves with that error object typed as `ReplayResult` — it does not throw. Check `response`-shaped data defensively, or inspect status via a custom `Transport`, rather than relying on a `catch` block for anything other than `ConfigurationError`, `TimeoutError`, or `NetworkError`.
</Warning>

## Catching errors

```ts theme={null}
import { ParmanaError, TimeoutError, NetworkError, ConfigurationError } from "parmana";

try {
  const client = new ParmanaClient(configuration);
  const trustRecord = await client.execute(transaction);
} catch (error) {
  if (error instanceof TimeoutError) {
    // request exceeded configuration.timeout
  } else if (error instanceof NetworkError) {
    // fetch rejected (DNS, connection refused, etc.)
  } else if (error instanceof ConfigurationError) {
    // missing endpoint or transport
  } else if (error instanceof ParmanaError) {
    // any other SDK-defined error (currently unreachable in practice)
  } else {
    throw error;
  }
}
```

## Related

<CardGroup cols={2}>
  <Card title="Error Model (REST API)" href="/docs/api/error-model">The server-side error shape these responses actually carry.</Card>
  <Card title="Installation" href="/docs/typescript-sdk/installation">Timeout and transport configuration.</Card>
  <Card title="Python SDK — errors" href="/docs/python-sdk/apis-and-models">Whether the Python client has the same gap.</Card>
</CardGroup>
