File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -59,16 +59,18 @@ shaka.net.HttpPlugin = function(uri, request) {
5959 var response = { uri : uri , data : target . response , headers : headers } ;
6060 resolve ( response ) ;
6161 } else {
62- if ( ! COMPILED ) {
63- var responseText =
64- shaka . util . StringUtils . fromBytesAutoDetect ( target . response ) ;
65- shaka . log . debug ( 'HTTP error text:' , responseText ) ;
66- }
62+ var responseText = null ;
63+ try {
64+ responseText = shaka . util . StringUtils . fromBytesAutoDetect (
65+ target . response ) ;
66+ } catch ( exception ) { }
67+ shaka . log . debug ( 'HTTP error text:' , responseText ) ;
6768 reject ( new shaka . util . Error (
6869 shaka . util . Error . Category . NETWORK ,
6970 shaka . util . Error . Code . BAD_HTTP_STATUS ,
7071 uri ,
71- target . status ) ) ;
72+ target . status ,
73+ responseText ) ) ;
7274 }
7375 } ;
7476 xhr . onerror = function ( event ) {
Original file line number Diff line number Diff line change @@ -135,6 +135,8 @@ shaka.util.Error.Code = {
135135 * An HTTP network request returned an HTTP status that indicated a failure.
136136 * <br> error.data[0] is the URI.
137137 * <br> error.data[1] is the status code.
138+ * <br> error.data[2] is the response text, or null if the response could not
139+ * be interpretted as text.
138140 */
139141 'BAD_HTTP_STATUS' : 1001 ,
140142
You can’t perform that action at this time.
0 commit comments