hacker-news-reel
Version:
A lightweight, typed client for the Hacker News API with validation using Zod
25 lines (24 loc) • 702 B
TypeScript
/**
* Custom error class for rate limit responses
* Contains information about the rate limit and when to retry
*/
export declare class RateLimitError extends Error {
/**
* HTTP status code (typically 429 Too Many Requests)
*/
status: number;
/**
* Original Response object from the fetch request
*/
response: Response;
/**
* Suggested retry time in seconds, extracted from the Retry-After header
*/
retryAfterSeconds?: number;
/**
* Creates a new RateLimitError
* @param message Error message
* @param response The response object that triggered the rate limit
*/
constructor(message: string, response: Response);
}