UNPKG

@j03fr0st/pubg-ts

Version:

A comprehensive TypeScript wrapper for the PUBG API

80 lines 3.13 kB
/** * Enhanced error context interface for better debugging */ export interface ErrorContext { correlationId?: string; timestamp?: number; operation?: string; metadata?: Record<string, any>; stack?: string; } /** * Base PUBG API error class with enhanced context support */ export declare class PubgApiError extends Error { statusCode?: number | undefined; response?: any | undefined; readonly correlationId: string; readonly timestamp: number; readonly context: ErrorContext; constructor(message: string, statusCode?: number | undefined, response?: any | undefined, context?: Partial<ErrorContext>); /** * Generate a unique correlation ID for error tracking */ private generateCorrelationId; /** * Get detailed error information for debugging */ getDetails(): Record<string, any>; /** * Get a formatted error message with context */ getFormattedMessage(): string; } export declare class PubgRateLimitError extends PubgApiError { retryAfter?: number | undefined; constructor(message?: string, retryAfter?: number | undefined, context?: Partial<ErrorContext>); } export declare class PubgAuthenticationError extends PubgApiError { constructor(message?: string, context?: Partial<ErrorContext>); } export declare class PubgNotFoundError extends PubgApiError { constructor(message?: string, context?: Partial<ErrorContext>); } export declare class PubgValidationError extends PubgApiError { constructor(message?: string, context?: Partial<ErrorContext>); } /** * Cache-related error for cache operations */ export declare class PubgCacheError extends PubgApiError { cacheKey: string; operation: 'get' | 'set' | 'delete' | 'cleanup' | 'eviction'; constructor(message: string, cacheKey: string, operation: 'get' | 'set' | 'delete' | 'cleanup' | 'eviction', context?: Partial<ErrorContext>); } /** * Asset management related errors */ export declare class PubgAssetError extends PubgApiError { assetId: string; assetType: 'item' | 'vehicle' | 'map' | 'season' | 'survival_title' | 'unknown'; constructor(message: string, assetId: string, assetType: 'item' | 'vehicle' | 'map' | 'season' | 'survival_title' | 'unknown', context?: Partial<ErrorContext>); } /** * Configuration validation errors */ export declare class PubgConfigurationError extends PubgApiError { configField: string; expectedType?: string | undefined; receivedValue?: any | undefined; constructor(message: string, configField: string, expectedType?: string | undefined, receivedValue?: any | undefined, context?: Partial<ErrorContext>); } /** * Network connectivity and communication errors */ export declare class PubgNetworkError extends PubgApiError { networkOperation: 'connect' | 'request' | 'timeout' | 'dns' | 'ssl' | 'unknown'; originalError?: Error | undefined; constructor(message: string, networkOperation: 'connect' | 'request' | 'timeout' | 'dns' | 'ssl' | 'unknown', originalError?: Error | undefined, context?: Partial<ErrorContext>); } //# sourceMappingURL=index.d.ts.map