erlc.ts
Version:
Clean and typesafe PRC API client for TypeScript
42 lines • 1.37 kB
TypeScript
import { PRCError } from './types.js';
/**
* Custom error class for PRC API errors.
* Extends the built-in Error class with additional properties.
*/
export declare class PRCAPIError extends Error {
readonly code: number | undefined;
readonly retryAfter: number | undefined;
/**
* Creates a new PRCAPIError instance.
* @param error - The PRC error object.
*/
constructor(error: PRCError);
/**
* Creates a PRCAPIError from a Response object.
* @param response - The fetch Response object.
* @param body - Optional response body.
* @returns A new PRCAPIError instance.
*/
static fromResponse(response: Response, body?: any): PRCAPIError;
/**
* Checks if the error is a rate limit error.
* @returns True if the error code is RATE_LIMITED.
*/
get isRateLimit(): boolean;
/**
* Checks if the error is due to server being offline.
* @returns True if the error code is SERVER_OFFLINE.
*/
get isServerOffline(): boolean;
/**
* Checks if the error is an authentication error.
* @returns True if the error code is an auth-related code.
*/
get isAuthError(): boolean;
/**
* Checks if the error is retryable.
* @returns True if the error can be retried.
*/
get isRetryable(): boolean;
}
//# sourceMappingURL=errors.d.ts.map