UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

124 lines (123 loc) 4.5 kB
/** * Voice Module Error Classes * * Comprehensive error handling for TTS, STT, and Realtime Voice operations. * * @module voice/errors */ import { NeuroLinkError } from "../utils/errorHandling.js"; import type { VoiceErrorOptions } from "../types/index.js"; import { REALTIME_ERROR_CODES, STT_ERROR_CODES, VOICE_ERROR_CODES } from "../types/index.js"; export { STT_ERROR_CODES, REALTIME_ERROR_CODES, VOICE_ERROR_CODES }; /** * Base Voice Error class for all voice-related errors */ export declare class VoiceError extends NeuroLinkError { constructor(options: VoiceErrorOptions); } /** * STT Error class for speech-to-text specific errors */ export declare class STTError extends VoiceError { constructor(options: VoiceErrorOptions); /** * Create an error for empty audio input */ static audioEmpty(provider?: string): STTError; /** * Create an error for audio that exceeds maximum duration */ static audioTooLong(durationSeconds: number, maxDurationSeconds: number, provider?: string): STTError; /** * Create an error for invalid audio format */ static invalidFormat(format: string, supportedFormatsOrProvider?: string[] | string, provider?: string): STTError; /** * Create an error for unsupported language */ static languageNotSupported(language: string, supportedLanguages?: string[], provider?: string): STTError; /** * Create an error for transcription failure * Supports two signatures: * - transcriptionFailed(reason, provider?, originalError?) * - transcriptionFailed(reason, originalError, provider) */ static transcriptionFailed(reason: string, providerOrError?: string | Error, originalErrorOrProvider?: Error | string): STTError; /** * Create an error for unconfigured provider */ static providerNotConfigured(provider: string): STTError; /** * Create an error for unsupported provider */ static providerNotSupported(provider: string, availableProviders?: string[]): STTError; /** * Create an error for stream processing failure */ static streamError(reason: string, provider?: string): STTError; /** * Alias for providerNotConfigured */ static notConfigured(provider: string): STTError; /** * Alias for audioEmpty */ static emptyAudio(provider?: string): STTError; } /** * Realtime Voice Error class for realtime-specific errors */ export declare class RealtimeError extends VoiceError { constructor(options: VoiceErrorOptions); /** * Create an error for connection failure * Supports two signatures: * - connectionFailed(reason, provider?, originalError?) * - connectionFailed(reason, originalError?, provider?) */ static connectionFailed(reason: string, providerOrError?: string | Error, originalErrorOrProvider?: Error | string): RealtimeError; /** * Create an error for session timeout */ static sessionTimeout(timeoutMs: number, provider?: string): RealtimeError; /** * Create an error for protocol errors */ static protocolError(reason: string, provider?: string, originalError?: Error): RealtimeError; /** * Create an error for audio stream failures */ static audioStreamError(reason: string, provider?: string): RealtimeError; /** * Create an error for unconfigured provider */ static providerNotConfigured(provider: string): RealtimeError; /** * Create an error for unsupported provider */ static providerNotSupported(provider: string, availableProviders?: string[]): RealtimeError; /** * Create an error for duplicate session */ static sessionAlreadyActive(provider?: string): RealtimeError; /** * Create an error for no active session */ static sessionNotActive(provider?: string): RealtimeError; /** * Create an error for invalid messages */ static invalidMessage(reason: string, provider?: string): RealtimeError; /** * Create an error for connection closed unexpectedly */ static connectionClosed(reason: string, sessionId?: string, provider?: string): RealtimeError; /** * Create an error for unconfigured provider (alias) */ static notConfigured(provider: string): RealtimeError; /** * Create an error for operation timeout */ static timeout(operation: string, timeoutMs: number, provider?: string): RealtimeError; }