assemblyai
Version:
The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.
52 lines (47 loc) • 1.93 kB
text/typescript
const StreamingErrorType = {
BadSampleRate: 4000,
AuthFailed: 4001,
InsufficientFunds: 4002,
FreeTierUser: 4003,
NonexistentSessionId: 4004,
SessionExpired: 4008,
ClosedSession: 4010,
RateLimited: 4029,
UniqueSessionViolation: 4030,
SessionTimeout: 4031,
AudioTooShort: 4032,
AudioTooLong: 4033,
AudioTooSmallToTranscode: 4034,
BadSchema: 4101,
TooManyStreams: 4102,
Reconnected: 4103,
} as const;
type StreamingErrorTypeCodes =
(typeof StreamingErrorType)[keyof typeof StreamingErrorType];
const StreamingErrorMessages: Record<StreamingErrorTypeCodes, string> = {
[]: "Sample rate must be a positive integer",
[]: "Not Authorized",
[]: "Insufficient funds",
[]:
"This feature is paid-only and requires you to add a credit card. Please visit https://app.assemblyai.com/ to add a credit card to your account.",
[]: "Session ID does not exist",
[]: "Session has expired",
[]: "Session is closed",
[]: "Rate limited",
[]: "Unique session violation",
[]: "Session Timeout",
[]: "Audio too short",
[]: "Audio too long",
[]: "Audio too small to transcode",
[]: "Bad schema",
[]: "Too many streams",
[]:
"This session has been reconnected. This WebSocket is no longer valid.",
};
class StreamingError extends Error {}
export {
StreamingError,
StreamingErrorType,
StreamingErrorTypeCodes,
StreamingErrorMessages,
};