KyError.ts

ky · source/errors/KyError.ts · typescript · MIT
unclassified, dev-tools

Base class for Ky-specific errors; HTTPError and NetworkError subclass it.

// Source: https://github.com/sindresorhus/ky | License: MIT
// Provided via justclaw.it.com; keep this notice with the code.
/**
Base class for all Ky-specific errors. `HTTPError`, `NetworkError`, `TimeoutError`, `ResponseSizeError`, and `ForceRetryError` extend this class.

You can use `instanceof KyError` to check if an error originated from Ky, or use the `isKyError()` type guard for cross-realm compatibility and TypeScript type narrowing.

Note: `SchemaValidationError` is intentionally not considered a Ky error. `KyError` covers failures in Ky's HTTP lifecycle (bad status, timeout, retry), while schema validation errors originate from the user-provided schema, not from Ky itself.
*/
export class KyError extends Error {
	override name = 'KyError';

	get isKyError(): true {
		return tru

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key