/** * Base error class for all Wildberries SDK errors. * * All SDK-specific errors extend this class to enable consumers to catch * all SDK errors with a single catch block if desired. * * @example * ```typescript * import { WBAPIError } from 'daytona-wildberries-typescript-sdk'; * * try { * await sdk.general.ping(); * } catch (error) { * if (error instanceof WBAPIError) { * console.error('SDK error:', error.getUserMessage()); * console.error('Status code:', error.statusCode); * } * } * ``` */ export declare class WBAPIError extends Error { /** * HTTP status code if applicable */ readonly statusCode?: number; /** * API response body if available */ readonly response?: unknown; /** * Correlation ID for debugging and tracing requests */ readonly requestId?: string; /** * Origin service identifier from RFC 7807 problem+json responses. * * Indicates which internal Wildberries service originated the error * (e.g., "s2s-api-auth-catalog"). */ readonly origin?: string; /** * ISO 8601 timestamp from RFC 7807 problem+json responses. * * Indicates when the error occurred on the server side * (e.g., "2024-09-30T06:52:38Z"). */ readonly timestamp?: string; /** * Creates a new WBAPIError * * @param message - Error message describing what went wrong * @param statusCode - HTTP status code if applicable * @param response - API response body if available * @param requestId - Correlation ID for debugging * @param origin - Origin service identifier from RFC 7807 responses * @param timestamp - ISO 8601 timestamp from RFC 7807 responses */ constructor(message: string, statusCode?: number, response?: unknown, requestId?: string, origin?: string, timestamp?: string); /** * Returns a human-readable error message with recovery guidance. * * Override this method in subclasses to provide specific recovery steps. * * @returns User-friendly error message with actionable guidance * * @example * ```typescript * try { * await sdk.products.createProduct(data); * } catch (error) { * if (error instanceof WBAPIError) { * // Show user-friendly message * alert(error.getUserMessage()); * * // Log technical details for debugging * console.error('Technical details:', { * statusCode: error.statusCode, * requestId: error.requestId * }); * } * } * ``` */ getUserMessage(): string; /** * Custom JSON serialization to preserve all error properties. * * By default, Error objects don't serialize the `message` property * when using JSON.stringify(). This method ensures all important * properties are included in the JSON output. * * @returns Object representation of the error for JSON serialization * * @example * ```typescript * const error = new WBAPIError('Test error', 400, { detail: 'info' }, 'req-123'); * const json = JSON.stringify(error); * // { "name": "WBAPIError", "message": "Test error", "statusCode": 400, ... } * ``` */ toJSON(): { name: string; message: string; statusCode?: number; response?: unknown; requestId?: string; origin?: string; timestamp?: string; }; } //# sourceMappingURL=base-error.d.ts.map