From 6231488784e3acea920719d0236b3cdf4d769e83 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Wed, 16 Dec 2015 15:57:05 -0800 Subject: [PATCH] Add docs to all error codes b/25306826 Change-Id: I0c00d0f3b92f87175d6009dd986c1bff130524a0 --- lib/media/webm_segment_index_parser.js | 2 +- lib/util/error.js | 114 ++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 2 deletions(-) diff --git a/lib/media/webm_segment_index_parser.js b/lib/media/webm_segment_index_parser.js index b9fe2153ad..1e8421472a 100644 --- a/lib/media/webm_segment_index_parser.js +++ b/lib/media/webm_segment_index_parser.js @@ -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(); diff --git a/lib/util/error.js b/lib/util/error.js index 934b4a54c3..7ba84a7d9b 100644 --- a/lib/util/error.js +++ b/lib/util/error.js @@ -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 }; @@ -64,27 +69,134 @@ shaka.util.Error.Category = { * @export */ shaka.util.Error.Code = { + /** + * A network request was made using an unsupported URI scheme. + *
error.data[0] is the URI. + */ 'UNSUPPORTED_SCHEME': 1, + + /** + * An HTTP network request returned an HTTP status that indicated a failure. + *
error.data[0] is the URI. + *
error.data[1] is the status code. + */ 'BAD_HTTP_STATUS': 2, + + /** + * An HTTP network request failed with an error, but not from the server. + *
error.data[0] is the URI. + */ 'HTTP_ERROR': 3, + + /** + * A network request timed out. + *
error.data[0] is the URI. + */ 'TIMEOUT': 4, + + /** + * A network request was made with a malformed data URI. + *
error.data[0] is the URI. + */ 'MALFORMED_DATA_URI': 5, + + /** + * A network request was made with a data URI using an unknown encoding. + *
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 };