Jump to: navigation, search

Grtc.Error

Some functions in the Grtc namespace can raise exceptions under certain circumstances. Each such exception is an instance of Grtc.Error.

Instance Attributes

name

A String representing the error code of the exception. The following error codes are used by Grtc.Error:

Code Constant Description
1 Grtc.CONFIGURATION_ERROR Error while processing configuration information
2 Grtc.CONNECTION_ERROR Error while connecting to the WebRTC Gateway
3 cGrtc.WEBRTC_NOT_SUPPORTED_ERROR Browser does not support WebRTC functionality
4 Grtc.INVALID_STATE_ERROR The client is in an invalid state for executing the given action
5 Grtc.NOT_READY_ERROR The client is not ready to process this action
6 Grtc.GRTC_ERROR Generic error not covered by other error codes
7 Grtc.GRTC_WARN Generic warning
8 Grtc.WEBRTC_ERROR Error on a WebRTC API call

message

Optional String describing the exception.

In the rest of this API Reference, when we say a method throws an error such as NOT_READY_ERROR, that is a shorter way of saying that the following code has been executed:

throw new Grtc.Error(Grtc.NOT_READY_ERROR, “some message”);

If there is a possibility that an API call might throw an exception, the web app is expected to catch it and do the relevant error processing, such as informing the user of the condition, presenting a status update on the web page, or logging the error message.

try {
    grtcClient.connect();
} catch (e) {
    // e may be an instance of Grtc.Error, where e.name is Grtc.CONNECTION_ERROR
    console.log(e.name);
}

Feedback

Comment on this article:

blog comments powered by Disqus
This page was last modified on April 24, 2014, at 11:31.