UNPKG

@revmax/agent-sdk

Version:

Official Node.js SDK for RevMax - billing, customer management, and usage tracking

73 lines (72 loc) 2.17 kB
/** * Base error class for RevMax SDK errors */ export declare class RevMaxError extends Error { /** * Additional error metadata */ readonly metadata: Record<string, any>; /** * Request ID associated with the error */ readonly requestId?: string; constructor(message: string, metadata?: Record<string, any>); } /** * Error thrown when there's an API-related issue */ export declare class RevMaxApiError extends RevMaxError { /** * HTTP status code if available */ readonly statusCode?: number; /** * API error code if available */ readonly errorCode?: string; constructor(message?: string, statusCode?: number, errorCode?: string, metadata?: Record<string, any>); } /** * Error thrown when authentication fails */ export declare class RevMaxAuthenticationError extends RevMaxError { constructor(message?: string, metadata?: Record<string, any>); } /** * Error thrown when rate limits are exceeded */ export declare class RevMaxRateLimitError extends RevMaxApiError { /** * Time to wait before retrying in seconds */ readonly retryAfter?: number; constructor(message?: string, retryAfter?: number, metadata?: Record<string, any>); } /** * Error thrown when a validation error occurs */ export declare class RevMaxValidationError extends RevMaxError { /** * Validation errors by field */ readonly validationErrors: Record<string, string[]>; constructor(message?: string, validationErrors?: Record<string, string[]>, metadata?: Record<string, any>); } /** * Error thrown when a resource is not found */ export declare class RevMaxNotFoundError extends RevMaxApiError { constructor(message?: string, statusCode?: number); } /** * Error thrown when initialization fails */ export declare class RevMaxInitializationError extends RevMaxError { constructor(message?: string, metadata?: Record<string, any>); } /** * Parse API error response into appropriate error object * @param error - Error from API request * @returns Appropriate RevMaxError instance */ export declare function parseApiError(error: any): RevMaxError;