Interface ProviderFallbackEvent

Payload emitted on the provider_fallback event when a provider in the chain fails and the proxy advances to the next candidate.

This event is emitted on the EventEmitter passed to the proxy constructor — typically the SpeechProviderResolver instance — so that callers can observe and log the fallback path without coupling to the proxy internals.

See

Example

resolver.on('provider_fallback', (event: ProviderFallbackEvent) => {
console.warn(`${event.kind} fallback: ${event.from} -> ${event.to}`, event.error);
});
interface ProviderFallbackEvent {
    from: string;
    to: string;
    kind: "stt" | "tts";
    error: unknown;
}

Properties

Properties

from: string

Unique identifier of the provider that failed.

to: string

Unique identifier of the provider that will be tried next.

kind: "stt" | "tts"

Whether this is an STT or TTS fallback chain.

error: unknown

The error thrown by the failing provider. Typed as unknown because providers may throw non-Error values (e.g. string messages, API response objects). Callers should use instanceof Error before accessing .message.