Merge pull request #166 from videojs/responsetext-errors
return responseText in errors
Showing
2 changed files
with
5 additions
and
1 deletions
... | @@ -65,6 +65,7 @@ | ... | @@ -65,6 +65,7 @@ |
65 | loader.error = { | 65 | loader.error = { |
66 | status: xhr.status, | 66 | status: xhr.status, |
67 | message: 'HLS playlist request error at URL: ' + url, | 67 | message: 'HLS playlist request error at URL: ' + url, |
68 | responseText: xhr.responseText, | ||
68 | code: (xhr.status >= 500) ? 4 : 2 | 69 | code: (xhr.status >= 500) ? 4 : 2 |
69 | }; | 70 | }; |
70 | return loader.trigger('error'); | 71 | return loader.trigger('error'); |
... | @@ -226,6 +227,7 @@ | ... | @@ -226,6 +227,7 @@ |
226 | loader.error = { | 227 | loader.error = { |
227 | status: this.status, | 228 | status: this.status, |
228 | message: 'HLS playlist request error at URL: ' + srcUrl, | 229 | message: 'HLS playlist request error at URL: ' + srcUrl, |
230 | responseText: this.responseText, | ||
229 | code: 2 // MEDIA_ERR_NETWORK | 231 | code: 2 // MEDIA_ERR_NETWORK |
230 | }; | 232 | }; |
231 | return loader.trigger('error'); | 233 | return loader.trigger('error'); | ... | ... |
... | @@ -240,6 +240,7 @@ | ... | @@ -240,6 +240,7 @@ |
240 | test('emits an error if a media refresh fails', function() { | 240 | test('emits an error if a media refresh fails', function() { |
241 | var | 241 | var |
242 | errors = 0, | 242 | errors = 0, |
243 | errorResponseText = 'custom error message', | ||
243 | loader = new videojs.Hls.PlaylistLoader('live.m3u8'); | 244 | loader = new videojs.Hls.PlaylistLoader('live.m3u8'); |
244 | 245 | ||
245 | loader.on('error', function() { | 246 | loader.on('error', function() { |
... | @@ -251,10 +252,11 @@ | ... | @@ -251,10 +252,11 @@ |
251 | '#EXTINF:10,\n' + | 252 | '#EXTINF:10,\n' + |
252 | '0.ts\n'); | 253 | '0.ts\n'); |
253 | clock.tick(10 * 1000); // trigger a refresh | 254 | clock.tick(10 * 1000); // trigger a refresh |
254 | requests.pop().respond(500); | 255 | requests.pop().respond(500, null, errorResponseText); |
255 | 256 | ||
256 | strictEqual(errors, 1, 'emitted an error'); | 257 | strictEqual(errors, 1, 'emitted an error'); |
257 | strictEqual(loader.error.status, 500, 'captured the status code'); | 258 | strictEqual(loader.error.status, 500, 'captured the status code'); |
259 | strictEqual(loader.error.responseText, errorResponseText, 'captured the responseText'); | ||
258 | }); | 260 | }); |
259 | 261 | ||
260 | test('switches media playlists when requested', function() { | 262 | test('switches media playlists when requested', function() { | ... | ... |
-
Please register or sign in to post a comment