UNPKG

dood-stream-client

Version:

🚀 A feature-rich client for the DoodStream API with caching, logging, and error handling

37 lines (36 loc) 1.24 kB
import { DoodStreamApiError } from "./api-error"; /** * 🏭 Factory for creating DoodStream API errors */ export declare class ErrorFactory { /** * 🛠️ Create an appropriate error object based on the response * * @param response - The error response from the API * @param defaultMessage - Default error message if none can be extracted * @returns An appropriate error object */ static createFromResponse(response: any, defaultMessage?: string): Error; /** * 🛠️ Create a network error * * @param error - The original error * @returns A network error object */ static createNetworkError(error: any): DoodStreamApiError; /** * 🛠️ Create a timeout error * * @param error - The original error * @returns A timeout error object */ static createTimeoutError(error: any): DoodStreamApiError; /** * 🛠️ Create a validation error * * @param message - The validation error message * @param context - Additional context about the validation error * @returns A validation error object */ static createValidationError(message: string, context?: Record<string, any>): DoodStreamApiError; }