neue Homepage auf react basis

This commit is contained in:
2026-08-07 21:39:30 +02:00
parent 164bdd19ad
commit ee89442c04
52191 changed files with 1230242 additions and 58 deletions
+14
View File
@@ -0,0 +1,14 @@
import type { ForceRetryOptions } from '../core/constants.js';
import { KyError } from './KyError.js';
/**
Error used to signal a forced retry from `afterResponse` hooks.
This is thrown when `ky.retry()` is returned from an `afterResponse` hook. It is observable in `beforeRetry` and `beforeError` hooks via the `isForceRetryError()` type guard.
*/
export declare class ForceRetryError extends KyError {
name: "ForceRetryError";
customDelay: number | undefined;
code: string | undefined;
customRequest: Request | undefined;
constructor(options?: ForceRetryOptions);
}
+25
View File
@@ -0,0 +1,25 @@
import { KyError } from './KyError.js';
import { NonError } from './NonError.js';
/**
Error used to signal a forced retry from `afterResponse` hooks.
This is thrown when `ky.retry()` is returned from an `afterResponse` hook. It is observable in `beforeRetry` and `beforeError` hooks via the `isForceRetryError()` type guard.
*/
export class ForceRetryError extends KyError {
name = 'ForceRetryError';
customDelay;
code;
customRequest;
constructor(options) {
// Runtime protection: wrap non-Error causes in NonError
// TypeScript type is Error for guidance, but JS users can pass anything
const cause = options?.cause
? (options.cause instanceof Error ? options.cause : new NonError(options.cause))
: undefined;
super(options?.code ? `Forced retry: ${options.code}` : 'Forced retry', cause ? { cause } : undefined);
this.customDelay = options?.delay;
this.code = options?.code;
this.customRequest = options?.request;
}
}
//# sourceMappingURL=ForceRetryError.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ForceRetryError.js","sourceRoot":"","sources":["../../source/errors/ForceRetryError.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC;;;;EAIE;AACF,MAAM,OAAO,eAAgB,SAAQ,OAAO;IAClC,IAAI,GAAG,iBAA0B,CAAC;IAC3C,WAAW,CAAqB;IAChC,IAAI,CAAqB;IACzB,aAAa,CAAsB;IAEnC,YAAY,OAA2B;QACtC,wDAAwD;QACxD,wEAAwE;QACxE,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK;YAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAChF,CAAC,CAAC,SAAS,CAAC;QAEb,KAAK,CACJ,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,cAAc,EAChE,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,SAAS,CAC3B,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,KAAK,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,OAAO,EAAE,OAAO,CAAC;IACvC,CAAC;CACD","sourcesContent":["import type {ForceRetryOptions} from '../core/constants.js';\nimport {KyError} from './KyError.js';\nimport {NonError} from './NonError.js';\n\n/**\nError used to signal a forced retry from `afterResponse` hooks.\n\nThis is thrown when `ky.retry()` is returned from an `afterResponse` hook. It is observable in `beforeRetry` and `beforeError` hooks via the `isForceRetryError()` type guard.\n*/\nexport class ForceRetryError extends KyError {\n\toverride name = 'ForceRetryError' as const;\n\tcustomDelay: number | undefined;\n\tcode: string | undefined;\n\tcustomRequest: Request | undefined;\n\n\tconstructor(options?: ForceRetryOptions) {\n\t\t// Runtime protection: wrap non-Error causes in NonError\n\t\t// TypeScript type is Error for guidance, but JS users can pass anything\n\t\tconst cause = options?.cause\n\t\t\t? (options.cause instanceof Error ? options.cause : new NonError(options.cause))\n\t\t\t: undefined;\n\n\t\tsuper(\n\t\t\toptions?.code ? `Forced retry: ${options.code}` : 'Forced retry',\n\t\t\tcause ? {cause} : undefined,\n\t\t);\n\n\t\tthis.customDelay = options?.delay;\n\t\tthis.code = options?.code;\n\t\tthis.customRequest = options?.request;\n\t}\n}\n"]}
+21
View File
@@ -0,0 +1,21 @@
import type { NormalizedOptions } from '../types/options.js';
import type { KyRequest } from '../types/request.js';
import type { KyResponse } from '../types/response.js';
import { KyError } from './KyError.js';
/**
Error thrown when the response has a non-2xx status code and `throwHttpErrors` is enabled.
The error has a `response` property with the `Response` object, a `request` property with the `Request` object, an `options` property with the normalized options (either passed to `ky` when creating an instance with `ky.create()` or directly when performing the request), and a `data` property with the pre-parsed response body. For JSON responses (based on `Content-Type`), the body is parsed using the `parseJson` option if set, or `JSON.parse` by default. For other content types, it is set as plain text. If the body is empty or parsing fails, `data` will be `undefined`. To avoid hanging or excessive buffering, `error.data` population is bounded by the request timeout and a 10 MiB response body size limit. The `data` property is populated before `beforeError` hooks run, so hooks can access it.
The response body is automatically consumed when populating `error.data`, so `error.response.json()` and other body methods will not work. Use `error.data` instead. The `error.response` object is still available for headers, status, etc.
Be aware that some types of errors, such as network errors, inherently mean that a response was not received. In that case, the error will be an instance of `NetworkError` instead of `HTTPError` and will not contain a `response` property.
*/
export declare class HTTPError<T = unknown> extends KyError {
name: "HTTPError";
response: KyResponse<T>;
request: KyRequest;
options: NormalizedOptions;
data: T | string | undefined;
constructor(response: Response, request: Request, options: NormalizedOptions);
}
+28
View File
@@ -0,0 +1,28 @@
import { KyError } from './KyError.js';
/**
Error thrown when the response has a non-2xx status code and `throwHttpErrors` is enabled.
The error has a `response` property with the `Response` object, a `request` property with the `Request` object, an `options` property with the normalized options (either passed to `ky` when creating an instance with `ky.create()` or directly when performing the request), and a `data` property with the pre-parsed response body. For JSON responses (based on `Content-Type`), the body is parsed using the `parseJson` option if set, or `JSON.parse` by default. For other content types, it is set as plain text. If the body is empty or parsing fails, `data` will be `undefined`. To avoid hanging or excessive buffering, `error.data` population is bounded by the request timeout and a 10 MiB response body size limit. The `data` property is populated before `beforeError` hooks run, so hooks can access it.
The response body is automatically consumed when populating `error.data`, so `error.response.json()` and other body methods will not work. Use `error.data` instead. The `error.response` object is still available for headers, status, etc.
Be aware that some types of errors, such as network errors, inherently mean that a response was not received. In that case, the error will be an instance of `NetworkError` instead of `HTTPError` and will not contain a `response` property.
*/
export class HTTPError extends KyError {
name = 'HTTPError';
response;
request;
options;
data;
constructor(response, request, options) {
const code = (response.status || response.status === 0) ? response.status : '';
const title = response.statusText ?? '';
const status = `${code} ${title}`.trim();
const reason = status ? `status code ${status}` : 'an unknown error';
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
this.response = response;
this.request = request;
this.options = options;
}
}
//# sourceMappingURL=HTTPError.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"HTTPError.js","sourceRoot":"","sources":["../../source/errors/HTTPError.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC;;;;;;;;EAQE;AACF,MAAM,OAAO,SAAuB,SAAQ,OAAO;IACzC,IAAI,GAAG,WAAoB,CAAC;IACrC,QAAQ,CAAgB;IACxB,OAAO,CAAY;IACnB,OAAO,CAAoB;IAC3B,IAAI,CAAyB;IAE7B,YAAY,QAAkB,EAAE,OAAgB,EAAE,OAA0B;QAC3E,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,eAAe,MAAM,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC;QAErE,KAAK,CAAC,uBAAuB,MAAM,KAAK,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAEzE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type {NormalizedOptions} from '../types/options.js';\nimport type {KyRequest} from '../types/request.js';\nimport type {KyResponse} from '../types/response.js';\nimport {KyError} from './KyError.js';\n\n/**\nError thrown when the response has a non-2xx status code and `throwHttpErrors` is enabled.\n\nThe error has a `response` property with the `Response` object, a `request` property with the `Request` object, an `options` property with the normalized options (either passed to `ky` when creating an instance with `ky.create()` or directly when performing the request), and a `data` property with the pre-parsed response body. For JSON responses (based on `Content-Type`), the body is parsed using the `parseJson` option if set, or `JSON.parse` by default. For other content types, it is set as plain text. If the body is empty or parsing fails, `data` will be `undefined`. To avoid hanging or excessive buffering, `error.data` population is bounded by the request timeout and a 10 MiB response body size limit. The `data` property is populated before `beforeError` hooks run, so hooks can access it.\n\nThe response body is automatically consumed when populating `error.data`, so `error.response.json()` and other body methods will not work. Use `error.data` instead. The `error.response` object is still available for headers, status, etc.\n\nBe aware that some types of errors, such as network errors, inherently mean that a response was not received. In that case, the error will be an instance of `NetworkError` instead of `HTTPError` and will not contain a `response` property.\n*/\nexport class HTTPError<T = unknown> extends KyError {\n\toverride name = 'HTTPError' as const;\n\tresponse: KyResponse<T>;\n\trequest: KyRequest;\n\toptions: NormalizedOptions;\n\tdata: T | string | undefined;\n\n\tconstructor(response: Response, request: Request, options: NormalizedOptions) {\n\t\tconst code = (response.status || response.status === 0) ? response.status : '';\n\t\tconst title = response.statusText ?? '';\n\t\tconst status = `${code} ${title}`.trim();\n\t\tconst reason = status ? `status code ${status}` : 'an unknown error';\n\n\t\tsuper(`Request failed with ${reason}: ${request.method} ${request.url}`);\n\n\t\tthis.response = response;\n\t\tthis.request = request;\n\t\tthis.options = options;\n\t}\n}\n"]}
+11
View File
@@ -0,0 +1,11 @@
/**
Base class for all Ky-specific errors. `HTTPError`, `NetworkError`, `TimeoutError`, 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 declare class KyError extends Error {
name: string;
get isKyError(): true;
}
+14
View File
@@ -0,0 +1,14 @@
/**
Base class for all Ky-specific errors. `HTTPError`, `NetworkError`, `TimeoutError`, 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 {
name = 'KyError';
get isKyError() {
return true;
}
}
//# sourceMappingURL=KyError.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"KyError.js","sourceRoot":"","sources":["../../source/errors/KyError.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AACF,MAAM,OAAO,OAAQ,SAAQ,KAAK;IACxB,IAAI,GAAG,SAAS,CAAC;IAE1B,IAAI,SAAS;QACZ,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["/**\nBase class for all Ky-specific errors. `HTTPError`, `NetworkError`, `TimeoutError`, and `ForceRetryError` extend this class.\n\nYou 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.\n\nNote: `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.\n*/\nexport class KyError extends Error {\n\toverride name = 'KyError';\n\n\tget isKyError(): true {\n\t\treturn true;\n\t}\n}\n"]}
+16
View File
@@ -0,0 +1,16 @@
import type { KyRequest } from '../types/request.js';
import { KyError } from './KyError.js';
/**
Error thrown when a network error occurs during the request (e.g., DNS failure, connection refused, offline). It has a `request` property with the `Request` object. The original error is available via the standard `cause` property.
Network errors are automatically retried (for retriable methods).
Note: Network errors are detected using runtime-specific heuristics. Unrecognized runtimes may produce errors that are not wrapped in `NetworkError`. Use the `shouldRetry` option to handle such cases.
*/
export declare class NetworkError extends KyError {
name: "NetworkError";
request: KyRequest;
constructor(request: Request, options?: {
cause?: Error;
});
}
+17
View File
@@ -0,0 +1,17 @@
import { KyError } from './KyError.js';
/**
Error thrown when a network error occurs during the request (e.g., DNS failure, connection refused, offline). It has a `request` property with the `Request` object. The original error is available via the standard `cause` property.
Network errors are automatically retried (for retriable methods).
Note: Network errors are detected using runtime-specific heuristics. Unrecognized runtimes may produce errors that are not wrapped in `NetworkError`. Use the `shouldRetry` option to handle such cases.
*/
export class NetworkError extends KyError {
name = 'NetworkError';
request;
constructor(request, options) {
super(`Request failed due to a network error: ${request.method} ${request.url}`, options);
this.request = request;
}
}
//# sourceMappingURL=NetworkError.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"NetworkError.js","sourceRoot":"","sources":["../../source/errors/NetworkError.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC;;;;;;EAME;AACF,MAAM,OAAO,YAAa,SAAQ,OAAO;IAC/B,IAAI,GAAG,cAAuB,CAAC;IACxC,OAAO,CAAY;IAEnB,YAAY,OAAgB,EAAE,OAAyB;QACtD,KAAK,CAAC,0CAA0C,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAC1F,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type {KyRequest} from '../types/request.js';\nimport {KyError} from './KyError.js';\n\n/**\nError thrown when a network error occurs during the request (e.g., DNS failure, connection refused, offline). It has a `request` property with the `Request` object. The original error is available via the standard `cause` property.\n\nNetwork errors are automatically retried (for retriable methods).\n\nNote: Network errors are detected using runtime-specific heuristics. Unrecognized runtimes may produce errors that are not wrapped in `NetworkError`. Use the `shouldRetry` option to handle such cases.\n*/\nexport class NetworkError extends KyError {\n\toverride name = 'NetworkError' as const;\n\trequest: KyRequest;\n\n\tconstructor(request: Request, options?: {cause?: Error}) {\n\t\tsuper(`Request failed due to a network error: ${request.method} ${request.url}`, options);\n\t\tthis.request = request;\n\t}\n}\n"]}
+10
View File
@@ -0,0 +1,10 @@
/**
Wrapper for non-Error values that were thrown.
In JavaScript, any value can be thrown (not just Error instances). This class wraps such values to ensure consistent error handling.
*/
export declare class NonError extends Error {
name: string;
readonly value: unknown;
constructor(value: unknown);
}
+27
View File
@@ -0,0 +1,27 @@
/**
Wrapper for non-Error values that were thrown.
In JavaScript, any value can be thrown (not just Error instances). This class wraps such values to ensure consistent error handling.
*/
export class NonError extends Error {
name = 'NonError';
value;
constructor(value) {
let message = 'Non-error value was thrown';
// Intentionally minimal as this error is just an edge-case.
try {
if (typeof value === 'string') {
message = value;
}
else if (value && typeof value === 'object' && 'message' in value && typeof value.message === 'string') {
message = value.message;
}
}
catch {
// Use default message if accessing properties throws
}
super(message);
this.value = value;
}
}
//# sourceMappingURL=NonError.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"NonError.js","sourceRoot":"","sources":["../../source/errors/NonError.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AACF,MAAM,OAAO,QAAS,SAAQ,KAAK;IACzB,IAAI,GAAG,UAAU,CAAC;IAClB,KAAK,CAAU;IAExB,YAAY,KAAc;QACzB,IAAI,OAAO,GAAG,4BAA4B,CAAC;QAE3C,4DAA4D;QAC5D,IAAI,CAAC;YACJ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC/B,OAAO,GAAG,KAAK,CAAC;YACjB,CAAC;iBAAM,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAC1G,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YACzB,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,qDAAqD;QACtD,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;CACD","sourcesContent":["/**\nWrapper for non-Error values that were thrown.\n\nIn JavaScript, any value can be thrown (not just Error instances). This class wraps such values to ensure consistent error handling.\n*/\nexport class NonError extends Error {\n\toverride name = 'NonError';\n\treadonly value: unknown;\n\n\tconstructor(value: unknown) {\n\t\tlet message = 'Non-error value was thrown';\n\n\t\t// Intentionally minimal as this error is just an edge-case.\n\t\ttry {\n\t\t\tif (typeof value === 'string') {\n\t\t\t\tmessage = value;\n\t\t\t} else if (value && typeof value === 'object' && 'message' in value && typeof value.message === 'string') {\n\t\t\t\tmessage = value.message;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Use default message if accessing properties throws\n\t\t}\n\n\t\tsuper(message);\n\n\t\tthis.value = value;\n\t}\n}\n"]}
+28
View File
@@ -0,0 +1,28 @@
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').json(userSchema);
console.log(user.name);
} catch (error) {
if (error instanceof SchemaValidationError) {
console.error(error.issues);
}
}
```
*/
export declare class SchemaValidationError extends Error {
name: "SchemaValidationError";
readonly issues: readonly StandardSchemaV1Issue[];
constructor(issues: readonly StandardSchemaV1Issue[]);
}
+31
View File
@@ -0,0 +1,31 @@
/**
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').json(userSchema);
console.log(user.name);
} catch (error) {
if (error instanceof SchemaValidationError) {
console.error(error.issues);
}
}
```
*/
export class SchemaValidationError extends Error {
name = 'SchemaValidationError';
issues;
constructor(issues) {
super('Response schema validation failed');
this.issues = issues;
}
}
//# sourceMappingURL=SchemaValidationError.js.map
@@ -0,0 +1 @@
{"version":3,"file":"SchemaValidationError.js","sourceRoot":"","sources":["../../source/errors/SchemaValidationError.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;EAqBE;AACF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACtC,IAAI,GAAG,uBAAgC,CAAC;IACxC,MAAM,CAAmC;IAElD,YAAY,MAAwC;QACnD,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD","sourcesContent":["import type {StandardSchemaV1Issue} from '../types/standard-schema.js';\n\n/**\nThe 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.\n\nThis 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()`.\n\n@example\n```\nimport ky, {SchemaValidationError} from 'ky';\nimport {z} from 'zod';\n\nconst userSchema = z.object({name: z.string()});\n\ntry {\n\tconst user = await ky('/api/user').json(userSchema);\n\tconsole.log(user.name);\n} catch (error) {\n\tif (error instanceof SchemaValidationError) {\n\t\tconsole.error(error.issues);\n\t}\n}\n```\n*/\nexport class SchemaValidationError extends Error {\n\toverride name = 'SchemaValidationError' as const;\n\treadonly issues: readonly StandardSchemaV1Issue[];\n\n\tconstructor(issues: readonly StandardSchemaV1Issue[]) {\n\t\tsuper('Response schema validation failed');\n\t\tthis.issues = issues;\n\t}\n}\n"]}
+10
View File
@@ -0,0 +1,10 @@
import type { KyRequest } from '../types/request.js';
import { KyError } from './KyError.js';
/**
Error thrown when the request times out. It has a `request` property with the `Request` object.
*/
export declare class TimeoutError extends KyError {
name: "TimeoutError";
request: KyRequest;
constructor(request: Request);
}
+13
View File
@@ -0,0 +1,13 @@
import { KyError } from './KyError.js';
/**
Error thrown when the request times out. It has a `request` property with the `Request` object.
*/
export class TimeoutError extends KyError {
name = 'TimeoutError';
request;
constructor(request) {
super(`Request timed out: ${request.method} ${request.url}`);
this.request = request;
}
}
//# sourceMappingURL=TimeoutError.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"TimeoutError.js","sourceRoot":"","sources":["../../source/errors/TimeoutError.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC;;EAEE;AACF,MAAM,OAAO,YAAa,SAAQ,OAAO;IAC/B,IAAI,GAAG,cAAuB,CAAC;IACxC,OAAO,CAAY;IAEnB,YAAY,OAAgB;QAC3B,KAAK,CAAC,sBAAsB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type {KyRequest} from '../types/request.js';\nimport {KyError} from './KyError.js';\n\n/**\nError thrown when the request times out. It has a `request` property with the `Request` object.\n*/\nexport class TimeoutError extends KyError {\n\toverride name = 'TimeoutError' as const;\n\trequest: KyRequest;\n\n\tconstructor(request: Request) {\n\t\tsuper(`Request timed out: ${request.method} ${request.url}`);\n\t\tthis.request = request;\n\t}\n}\n"]}