agents
Version:
A home for your AI agents
44 lines (43 loc) • 1.41 kB
TypeScript
//#region src/voice/errors.d.ts
interface VoiceProviderErrorOptions {
code?: string | number;
status?: number;
closeCode?: number;
closeReason?: string;
wasClean?: boolean;
}
/**
* Error raised at a voice provider boundary. Only known, content-free provider
* metadata belongs here. Provider response bodies and raw events must stay out.
*/
declare class VoiceProviderError extends Error {
readonly code?: string | number;
readonly status?: number;
readonly closeCode?: number;
readonly closeReason?: string;
readonly wasClean?: boolean;
constructor(message: string, options?: VoiceProviderErrorOptions);
}
interface VoiceErrorLogOptions {
component: string;
stage: string;
message: string;
error: Error;
connectionId?: string;
}
/** Convert a value caught from an external boundary without inspecting it. */
declare function toVoiceError(error: unknown, fallback: string): Error;
/** Return a bounded direct message suitable for the existing string wire API. */
declare function voiceErrorMessage(error: Error, fallback: string): string;
/** Emit one structured object so Workers Logs can extract diagnostic fields. */
declare function logVoiceError(options: VoiceErrorLogOptions): void;
//#endregion
export {
VoiceErrorLogOptions,
VoiceProviderError,
VoiceProviderErrorOptions,
logVoiceError,
toVoiceError,
voiceErrorMessage
};
//# sourceMappingURL=errors.d.ts.map