UNPKG

dexpaprika-sdk

Version:
56 lines (55 loc) 1.91 kB
/** * Custom error classes for DexPaprika SDK */ /** * Base error class for all DexPaprika SDK errors */ export declare class DexPaprikaError extends Error { constructor(message: string); } /** * Error thrown when a network is not found or invalid */ export declare class NetworkNotFoundError extends DexPaprikaError { constructor(networkId: string); } /** * Error thrown when a pool is not found */ export declare class PoolNotFoundError extends DexPaprikaError { constructor(poolAddress: string); } /** * General API error with status code */ export declare class ApiError extends DexPaprikaError { statusCode: number; constructor(message: string, statusCode: number); } /** * Optional deprecation hints surfaced by the API response body. */ export interface DeprecationDetails { /** Replacement path advertised by the API (e.g. "/networks/:network/pools/search"). */ replacement?: string; /** Raw deprecation message from the API response body (e.g. "endpoint removed"). */ apiMessage?: string; } /** * Error thrown when trying to use a deprecated endpoint. * * When the API response body carries a "replacement" hint, it is surfaced on * the {@link DeprecatedEndpointError.replacement} field and folded into the * error message, so future deprecations self-document without an SDK change. */ export declare class DeprecatedEndpointError extends DexPaprikaError { /** The deprecated endpoint that was called. */ readonly endpoint: string; /** Human-facing suggestion for what to use instead. */ readonly alternative: string; /** Replacement path advertised by the API response body, when present. */ readonly replacement?: string; /** Raw deprecation message from the API response body, when present. */ readonly apiMessage?: string; constructor(endpoint: string, alternative: string, details?: DeprecationDetails); }