/** * Custom error types for x-client-transaction-id. */ /** Options for constructing error instances with an optional cause and code. */ type ErrorOptionsWithCode = { cause?: unknown; code?: string; }; /** Base error class for all client transaction related errors. */ declare class ClientTransactionError extends Error { readonly code: string; /** * Creates a new ClientTransactionError. * @param message Error message * @param options Optional cause and error code */ constructor(message: string, options?: ErrorOptionsWithCode); } /** Error thrown when ClientTransaction initialization fails. */ declare class ClientTransactionInitializationError extends ClientTransactionError { /** * Creates a new ClientTransactionInitializationError. * @param message Error message * @param options Optional cause and error code */ constructor(message: string, options?: ErrorOptionsWithCode); } /** Error thrown when the ondemand file URL cannot be resolved from the homepage runtime. */ declare class OnDemandFileUrlResolutionError extends ClientTransactionInitializationError { constructor(); } /** Error thrown when fetching the ondemand file fails. */ declare class OnDemandFileFetchError extends ClientTransactionInitializationError { readonly url: string; readonly status: number; readonly statusText: string; /** * Creates a new OnDemandFileFetchError. * @param url URL that was fetched * @param status HTTP status code * @param statusText HTTP status text */ constructor(url: string, status: number, statusText: string); } /** Error thrown when key byte indices cannot be extracted from the ondemand chunk. */ declare class KeyByteIndicesExtractionError extends ClientTransactionInitializationError { constructor(); } /** Error thrown when the twitter-site-verification meta tag is not found. */ declare class SiteVerificationKeyNotFoundError extends ClientTransactionInitializationError { constructor(); } /** Error thrown when indices are accessed before initialization. */ declare class IndicesNotInitializedError extends ClientTransactionError { constructor(); } /** Error thrown when animation frame data cannot be built for a given row. */ declare class AnimationFrameDataError extends ClientTransactionInitializationError { readonly rowIndex: number; /** * Creates a new AnimationFrameDataError. * @param rowIndex Row index that failed */ constructor(rowIndex: number); } /** Error thrown when ClientTransaction is used before initialization. */ declare class ClientTransactionNotInitializedError extends ClientTransactionError { constructor(); } /** * Base error class for errors raised while fetching X's web app shell. * * Historically named after X's now-removed domain migration flow; the class * is still used as the base for {@link XHomePageFetchError}. */ declare class HandleXMigrationError extends ClientTransactionError { /** * Creates a new HandleXMigrationError. * @param message Error message * @param options Optional cause and error code */ constructor(message: string, options?: ErrorOptionsWithCode); } /** Error thrown when fetching the X homepage fails. */ declare class XHomePageFetchError extends HandleXMigrationError { readonly status: number; readonly statusText: string; /** * Creates a new XHomePageFetchError. * @param status HTTP status code * @param statusText HTTP status text */ constructor(status: number, statusText: string); } /** * Error thrown when following the X migration redirect fails. * * @deprecated X no longer performs a domain migration step. This error is * retained only for backward compatibility and is no longer * thrown by the library. */ declare class XMigrationRedirectionError extends HandleXMigrationError { readonly status: number; readonly statusText: string; /** * Creates a new XMigrationRedirectionError. * @param status HTTP status code * @param statusText HTTP status text */ constructor(status: number, statusText: string); } /** * Error thrown when submitting the X migration form fails. * * @deprecated X no longer performs a domain migration step. This error is * retained only for backward compatibility and is no longer * thrown by the library. */ declare class XMigrationFormError extends HandleXMigrationError { readonly status: number; readonly statusText: string; /** * Creates a new XMigrationFormError. * @param status HTTP status code * @param statusText HTTP status text */ constructor(status: number, statusText: string); } /** Error thrown when interpolation inputs have mismatched lengths. */ declare class InterpolationInputError extends ClientTransactionError { readonly fromLength: number; readonly toLength: number; /** * Creates a new InterpolationInputError. * @param fromLength Length of the from array * @param toLength Length of the to array */ constructor(fromLength: number, toLength: number); } export { AnimationFrameDataError, ClientTransactionError, ClientTransactionInitializationError, ClientTransactionNotInitializedError, HandleXMigrationError, IndicesNotInitializedError, InterpolationInputError, KeyByteIndicesExtractionError, OnDemandFileFetchError, OnDemandFileUrlResolutionError, SiteVerificationKeyNotFoundError, XHomePageFetchError, XMigrationFormError, XMigrationRedirectionError, }; //# sourceMappingURL=errors.d.ts.map