Back to Content

SpeechRecognitionErrorEvent

files/en-us/web/api/speechrecognitionerrorevent/index.md

latest1.1 KB
Original Source

{{APIRef("Web Speech API")}}

The SpeechRecognitionErrorEvent interface of the Web Speech API represents error messages from the recognition service.

{{InheritanceDiagram}}

Constructor

  • {{domxref("SpeechRecognitionErrorEvent.SpeechRecognitionErrorEvent", "SpeechRecognitionErrorEvent()")}}
    • : Creates a new SpeechRecognitionErrorEvent object.

Instance properties

SpeechRecognitionErrorEvent also inherits properties from its parent interface, {{domxref("Event")}}.

  • {{domxref("SpeechRecognitionErrorEvent.error")}} {{ReadOnlyInline}}
    • : Returns the type of error raised.
  • {{domxref("SpeechRecognitionErrorEvent.message")}} {{ReadOnlyInline}}
    • : Returns a message describing the error in more detail.

Examples

js
const recognition = new SpeechRecognition();

recognition.onerror = (event) => {
  console.log(`Speech recognition error detected: ${event.error}`);
  console.log(`Additional information: ${event.message}`);
};

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also