# Class EPAPIError

EP API error for European Parliament API failures

Thrown when the European Parliament API returns an error or when communication with the API fails. Preserves the original status code from the upstream API.

#### Example

    const response = await fetch(epApiUrl);
    if (!response.ok) {
      throw new EPAPIError(
        'Failed to fetch MEP data',
        response.status,
        { url: epApiUrl, status: response.statusText }
      );
    }

#### Hierarchy (View Summary)

- MCPServerError
  - EPAPIError

- Defined in types/errors.ts:134

##### Index

### Constructors

constructor

### Properties

code
statusCode
details?

## Constructors

### constructor

- new EPAPIError(
  message: string,
  statusCode: number,
  details?: unknown,
  ): EPAPIError

  Create a new EP API error

  #### Parameters

  - message: string

    Description of API failure

  - statusCode: number

    HTTP status code from EP API

  - `Optional` details: unknown

    Optional details about the failure

  #### Returns EPAPIError

  Overrides MCPServerError.constructor

  - Defined in types/errors.ts:142

## Properties

### `Readonly` code

code: string

Machine-readable error code (e.g., 'VALIDATION_ERROR')

Inherited from MCPServerError.code

- Defined in types/errors.ts:44

### `Readonly` statusCode

statusCode: number = 500

HTTP status code (default: 500)

Inherited from MCPServerError.statusCode

- Defined in types/errors.ts:45

### `Optional` `Readonly` details

details?: unknown

Optional additional error details for debugging

Inherited from MCPServerError.details

- Defined in types/errors.ts:46