Skip to content

Commit

Permalink
Add docs to all error codes
Browse files Browse the repository at this point in the history
b/25306826

Change-Id: I0c00d0f3b92f87175d6009dd986c1bff130524a0
  • Loading branch information
joeyparrish committed Dec 17, 2015
1 parent 0b4ba1f commit 6231488
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/media/webm_segment_index_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ shaka.media.WebmSegmentIndexParser.prototype.parseWebmContainer_ = function(
shaka.log.error('Not an EBML element.');
throw new shaka.util.Error(
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.WEBM_EBML_ELEMENT_MISSING);
shaka.util.Error.Code.WEBM_EBML_HEADER_ELEMENT_MISSING);
}

var segmentElement = parser.parseElement();
Expand Down
114 changes: 113 additions & 1 deletion lib/util/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ shaka.util.Error = function(category, code, var_args) {
* @export
*/
shaka.util.Error.Category = {
/** Errors from the network stack. */
'NETWORK': 1,

/** Errors parsing text streams. */
'TEXT': 2,

/** Errors parsing or processing audio or video streams. */
'MEDIA': 3
};

Expand All @@ -64,27 +69,134 @@ shaka.util.Error.Category = {
* @export
*/
shaka.util.Error.Code = {
/**
* A network request was made using an unsupported URI scheme.
* <br> error.data[0] is the URI.
*/
'UNSUPPORTED_SCHEME': 1,

/**
* An HTTP network request returned an HTTP status that indicated a failure.
* <br> error.data[0] is the URI.
* <br> error.data[1] is the status code.
*/
'BAD_HTTP_STATUS': 2,

/**
* An HTTP network request failed with an error, but not from the server.
* <br> error.data[0] is the URI.
*/
'HTTP_ERROR': 3,

/**
* A network request timed out.
* <br> error.data[0] is the URI.
*/
'TIMEOUT': 4,

/**
* A network request was made with a malformed data URI.
* <br> error.data[0] is the URI.
*/
'MALFORMED_DATA_URI': 5,

/**
* A network request was made with a data URI using an unknown encoding.
* <br> error.data[0] is the URI.
*/
'UNKNOWN_DATA_URI_ENCODING': 6,

/** The text parser failed to parse a text stream due to an invalid header. */
'INVALID_TEXT_HEADER': 7,

/** The text parser failed to parse a text stream due to an invalid cue. */
'INVALID_TEXT_CUE': 8,

/**
* The text parser failed to parse a text stream due to invalid cue settings.
*/
'INVALID_TEXT_SETTINGS': 9,

/**
* Some component tried to read past the end of a buffer. The segment index,
* init segment, or PSSH may be malformed.
*/
'BUFFER_READ_OUT_OF_BOUNDS': 10,

/**
* Some component tried to parse an integer that was too large to fit in a
* JavaScript number without rounding error. JavaScript can only natively
* represent integers up to 53 bits.
*/
'JS_INTEGER_OVERFLOW': 11,

/**
* The EBML parser used to parse the WebM container encountered an integer,
* ID, or other field larger than the maximum supported by the parser.
*/
'EBML_OVERFLOW': 12,

/**
* The EBML parser used to parse the WebM container encountered a floating-
* point field of a size not supported by the parser.
*/
'EBML_BAD_FLOATING_POINT_SIZE': 13,

/**
* The MP4 SIDX parser found the wrong box type.
* Either the segment index range is incorrect or the data is corrupt.
*/
'MP4_SIDX_WRONG_BOX_TYPE': 14,

/**
* The MP4 SIDX parser encountered an invalid timescale.
* The segment index data may be corrupt.
*/
'MP4_SIDX_INVALID_TIMESCALE': 15,

/** The MP4 SIDX parser encountered a type of SIDX that is not supported. */
'MP4_SIDX_TYPE_NOT_SUPPORTED': 16,

/**
* The WebM Cues parser was unable to locate the Cues element.
* The segment index data may be corrupt.
*/
'WEBM_CUES_ELEMENT_MISSING': 17,
'WEBM_EBML_ELEMENT_MISSING': 18,

/**
* The WebM header parser was unable to locate the Ebml element.
* The init segment data may be corrupt.
*/
'WEBM_EBML_HEADER_ELEMENT_MISSING': 18,

/**
* The WebM header parser was unable to locate the Segment element.
* The init segment data may be corrupt.
*/
'WEBM_SEGMENT_ELEMENT_MISSING': 19,

/**
* The WebM header parser was unable to locate the Info element.
* The init segment data may be corrupt.
*/
'WEBM_INFO_ELEMENT_MISSING': 20,

/**
* The WebM header parser was unable to locate the Duration element.
* The init segment data may be corrupt or may have been incorrectly encoded.
* Shaka requires a duration in WebM DASH content.
*/
'WEBM_DURATION_ELEMENT_MISSING': 21,

/**
* The WebM Cues parser was unable to locate the Cue Track Positions element.
* The segment index data may be corrupt.
*/
'WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING': 22,

/**
* The WebM Cues parser was unable to locate the Cue Time element.
* The segment index data may be corrupt.
*/
'WEBM_CUE_TIME_ELEMENT_MISSING': 23
};

0 comments on commit 6231488

Please sign in to comment.