import type { AdapterResponse, HttpServiceStatus } from "../http/http.models.js"; import type { KontentErrorResponseData, RetryStrategyOptions } from "./core.models.js"; export type ErrorReason = "invalidResponse" | "invalidUrl" | "unknown" | "invalidBody" | "notFound"; export type CoreSdkErrorDetails = (Details<"invalidResponse", { readonly kontentErrorResponse: KontentErrorResponseData | undefined; } & Pick, "isValidResponse" | "responseHeaders" | "status" | "statusText">> | Details<"notFound", { readonly kontentErrorResponse: KontentErrorResponseData | undefined; } & Pick, "isValidResponse" | "responseHeaders" | "status" | "statusText">> | Details<"invalidBody", { readonly originalError: unknown; }> | Details<"invalidUrl", { readonly originalError: unknown; }> | Details<"unknown", { readonly originalError: unknown; }>) & { readonly reason: TReason; }; export type CoreSdkError = { /** * The message of the error */ readonly message: string; /** * The URL of the request. */ readonly url: string; /** * Used retry strategy. */ readonly retryStrategyOptions?: Required; /** * The number of times the request has been retried. */ readonly retryAttempt?: number; } & CoreSdkErrorDetails; type Details = { readonly reason: TReason; } & TDetails; export {};