export declare abstract class ApiError extends Error { data: ErrorData; constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API response indicates that the request was not valid. */ export declare class ValidationError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API response indicates that the request was not * authorized. */ export declare class UnauthorizedError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API response indicates that the operation exceeded * the capabilities of the user's payment plan. Examples include: * * - Using features not included in the user's plan * - Exceeding the resource limits of the plan */ export declare class InadequateEntitlementsError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API response indicates that the requested resource * could not be found. */ export declare class NotFoundError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API response indicates that the request was not * allowed. */ export declare class ForbiddenError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * The `errorCode` of a 403 for credentials that cannot access the account * the request named. A bare 403 (no code) means the role lacks a permission. */ export declare const ACCOUNT_NOT_ACCESSIBLE = "ERR_ACCOUNT_NOT_ACCESSIBLE"; export declare function isAccountNotAccessible(err: unknown): boolean; /** * The `errorCode` of a 403 for a Rocky AI request on an account that has * Rocky AI switched off in its settings. */ export declare const ROCKY_AI_DISABLED = "ERR_ROCKY_AI_DISABLED"; export declare function isRockyAiDisabled(err: unknown): boolean; /** * Error thrown when an API response indicates that the request conflicts * with server state. */ export declare class ConflictError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API response indicates that the request payload * exceeded the maximum size the endpoint accepts. */ export declare class PayloadTooLargeError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API response indicates a server error. */ export declare class ServerError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API response indicates an error that is not handled * globally. */ export declare class MiscellaneousError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } /** * Error thrown when an API request times out. */ export declare class RequestTimeoutError extends ApiError { constructor(data: ErrorData, options?: ErrorOptions); } export interface ErrorData { statusCode: number; error: string; errorCode?: string; message: string; /** * What the error is, where the status alone does not say: the deploy preview * endpoint answers 404 with `DEPLOY_PLAN_DISABLED` while plans are switched * off, which is not the 404 of an API that has no such endpoint. */ code?: string; /** * Set on a 409 from the async project-deploy endpoint: the id of the in-flight * deployment that blocked this one. Lets the client attach to or cancel it. */ deploymentId?: string; /** * The response's `retry-after` header, verbatim, when it carried one. Set * from the response rather than the body, so a caller that retries a * transient failure itself (rather than leaving it to the retry * interceptor) can honour what the server asked for. */ retryAfter?: string; } export interface ErrorDataOptions { statusCode: number; } export declare function parseErrorData(data: any, options: ErrorDataOptions): ErrorData | undefined; /** * Error thrown when an API request unexpectedly produces no response. */ export declare class MissingResponseError extends Error { constructor(options: ErrorOptions); } /** * Error thrown when the configured proxy cannot be reached. */ export declare class ProxyConnectionError extends Error { constructor(proxyUrl: string, options: ErrorOptions); } export declare function handleErrorResponse(err: Error): never;