import type { RateLimitInfo } from './utils/rate-limit'; /** Machine-readable category of a GHLError. Branch on it or use `instanceof` with the subclasses below. */ export type GHLErrorCode = 'AUTHENTICATION' | 'FORBIDDEN' | 'NOT_FOUND' | 'VALIDATION' | 'RATE_LIMIT' | 'SERVER' | 'NETWORK' | 'REQUEST' | 'UNKNOWN'; export declare class GHLError extends Error { statusCode?: number; response?: any; request?: any; code: GHLErrorCode; constructor(message: string, statusCode?: number, response?: any, request?: any, code?: GHLErrorCode); } /** 401 - the token is missing, invalid or expired and could not be refreshed */ export declare class GHLAuthenticationError extends GHLError { constructor(message: string, statusCode?: number, response?: any, request?: any); } /** The refresh token was rejected (already used, revoked or the app was uninstalled); the app must be reconnected */ export declare class GHLRefreshTokenInvalidError extends GHLAuthenticationError { } /** 403 - the token does not have the required scopes or access */ export declare class GHLForbiddenError extends GHLError { constructor(message: string, statusCode?: number, response?: any, request?: any); } /** 404 - the resource does not exist */ export declare class GHLNotFoundError extends GHLError { constructor(message: string, statusCode?: number, response?: any, request?: any); } /** 400 / 422 - the request was rejected by validation */ export declare class GHLValidationError extends GHLError { constructor(message: string, statusCode?: number, response?: any, request?: any); } /** 429 - rate limit exceeded. `rateLimit` holds the parsed x-ratelimit-* headers and which limit (burst or daily) was hit */ export declare class GHLRateLimitError extends GHLError { rateLimit?: RateLimitInfo; constructor(message: string, statusCode?: number, response?: any, request?: any, rateLimit?: RateLimitInfo); } /** 5xx - the API failed to process the request */ export declare class GHLServerError extends GHLError { constructor(message: string, statusCode?: number, response?: any, request?: any); } /** The request was sent but no response was received */ export declare class GHLNetworkError extends GHLError { constructor(message: string, statusCode?: number, response?: any, request?: any); } /** * Build the most specific GHLError subclass for an HTTP status code. * Every subclass reports `name === 'GHLError'` so existing checks keep working. */ export declare function createGHLError(message: string, statusCode: number, response?: any, request?: any, rateLimit?: RateLimitInfo): GHLError; //# sourceMappingURL=errors.d.ts.map