UNPKG

@trendmoon/api-client

Version:
51 lines 1.73 kB
/** * Custom error classes for the Trendmoon SDK */ /** * Base error class for all Trendmoon SDK errors */ export declare class TrendmoonError extends Error { readonly code?: string | undefined; readonly timestamp: string; constructor(message: string, code?: string | undefined); } /** * Error thrown when API requests fail */ export declare class TrendmoonApiError extends TrendmoonError { readonly statusCode?: number | undefined; readonly responseBody?: string | undefined; constructor(message: string, statusCode?: number | undefined, responseBody?: string | undefined, code?: string); } /** * Error thrown when network requests fail */ export declare class TrendmoonNetworkError extends TrendmoonError { readonly originalError?: Error | undefined; constructor(message: string, originalError?: Error | undefined); } /** * Error thrown when request validation fails */ export declare class TrendmoonValidationError extends TrendmoonError { readonly field?: string | undefined; constructor(message: string, field?: string | undefined); } /** * Error thrown when rate limits are exceeded */ export declare class TrendmoonRateLimitError extends TrendmoonApiError { readonly retryAfter?: number | undefined; constructor(message?: string, retryAfter?: number | undefined); } /** * Error thrown when authentication fails */ export declare class TrendmoonAuthError extends TrendmoonApiError { constructor(message?: string); } /** * Utility function to determine error type from HTTP status code */ export declare function createErrorFromResponse(status: number, statusText: string, responseBody?: string): TrendmoonApiError; //# sourceMappingURL=errors.d.ts.map