UNPKG

dexscreener-sdk

Version:

A TypeScript wrapper for the DEX Screener API, providing easy access to token profiles, boosts, orders, pairs, and more.

16 lines (15 loc) 601 B
export class DexScreenerError extends Error { constructor(message, statusCode, response) { super(message); this.statusCode = statusCode; this.response = response; this.name = 'DexScreenerError'; } } export const handleApiError = (error) => { var _a; if (error.response) { throw new DexScreenerError(((_a = error.response.data) === null || _a === void 0 ? void 0 : _a.message) || 'API request failed', error.response.status, error.response.data); } throw new DexScreenerError(error.message || 'Network error occurred'); };