Defines SchemaValidationError, an Error subclass for schema-validation failures in HTTP client exception handling.
// Source: https://github.com/sindresorhus/ky | License: MIT
// Provided via justclaw.it.com; keep this notice with the code.
import type {StandardSchemaV1Issue} from '../types/standard-schema.js';
/**
The error thrown when [Standard Schema](https://github.com/standard-schema/standard-schema) validation fails in `.json(schema)`. It has an `issues` property with the validation issues from the schema.
This error intentionally does not extend `KyError` because it does not represent a failure in Ky's HTTP lifecycle. The request succeeded; the user's schema rejected the data. As such, it is not matched by `isKyError()`.
@example
```
import ky, {SchemaValidationError} from 'ky';
import {z} from 'zod';
const userSchema = z.object({name: z.string()});
try {
const user = await ky('/api/user')
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key