onerror Event
Occurs when a serious or fatal error is encountered during the playback process.
HTML | <PromptQueue.onerror="eventHandler()"> |
JScript | PromptQueue.onerror = eventHandler; |
Named Script | <SCRIPT FOR = PromptQueue EVENT = onerror> |
Remarks
When the onerror event occurs during playback, the status property is updated with a corresponding error code as described below.
Value | Description |
---|---|
0 | The prompt playback occurred normally. No errors were encountered. |
-1 | A generic speech output resource error occurred during playback. |
-2 | The Start method call was made on an empty prompt subqueue. |
-3 | The Change method was called but the Speech Platform does not support it. |
-30 | A disconnect initiated the Flush method, or prompt playback was attempted after a disconnect. (Telephony only) |
Although the event handler does not receive properties directly, the handler can query the event object for data.
Example
The following example demonstrates the onerror event.
PromptQueue.onempty = OnPromptQueueEmpty();
PromptQueue.onerror = OnPromptQueueError();
StartEmptyPromptQueue();
function OnPromptQueueEmpty() {
LogMessage("INFORMATIONAL", "PromptQueue playback has completed, the status is: " + PromptQueue.status);
}
function OnPromptQueueError() {
LogMessage("ERROR", "A PromptQueue error has occurred, the status is: " + PromptQueue.status);
}
function StartEmptyPromptQueue() {
PromptQueue.Start();
}