# Class ValidationError

Validation error for input validation failures

Thrown when user input fails validation (e.g., invalid country code, out of range limit, malformed ID). Always returns HTTP 400 status.

#### Example

    if (!isValidCountryCode(country)) {
      throw new ValidationError(
        'Invalid country code',
        { country, expected: 'ISO 3166-1 alpha-2' }
      );
    }

#### Hierarchy (View Summary)

- MCPServerError
  - ValidationError

- Defined in types/errors.ts:70

##### Index

### Constructors

constructor

### Properties

code
statusCode
details?

## Constructors

### constructor

- new ValidationError(message: string, details?: unknown): ValidationError

  Create a new validation error

  #### Parameters

  - message: string

    Description of validation failure

  - `Optional` details: unknown

    Optional details about what failed validation

  #### Returns ValidationError

  Overrides MCPServerError.constructor

  - Defined in types/errors.ts:77

## 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