From 8fdd3441a6c5f7115ae857a770e89a0dd2a7e08e Mon Sep 17 00:00:00 2001 From: Jeremy Press Date: Wed, 10 Oct 2018 11:03:27 -0700 Subject: [PATCH] Fix: Pass shaka data to error detail so it can be logged (#848) --- src/lib/viewers/media/DashViewer.js | 5 ++++- src/lib/viewers/media/__tests__/DashViewer-test.js | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/viewers/media/DashViewer.js b/src/lib/viewers/media/DashViewer.js index 89f7a9f34..9de1b77f0 100644 --- a/src/lib/viewers/media/DashViewer.js +++ b/src/lib/viewers/media/DashViewer.js @@ -406,7 +406,10 @@ class DashViewer extends VideoBaseViewer { const error = new PreviewError( ERROR_CODE.SHAKA, __('error_refresh'), - {}, + { + code: normalizedShakaError.code, + severity: normalizedShakaError.severity + }, `Shaka error. Code = ${normalizedShakaError.code}, Category = ${ normalizedShakaError.category }, Severity = ${normalizedShakaError.severity}, Data = ${normalizedShakaError.data.toString()}` diff --git a/src/lib/viewers/media/__tests__/DashViewer-test.js b/src/lib/viewers/media/__tests__/DashViewer-test.js index 2969bf3c3..4876e0962 100644 --- a/src/lib/viewers/media/__tests__/DashViewer-test.js +++ b/src/lib/viewers/media/__tests__/DashViewer-test.js @@ -547,6 +547,8 @@ describe('lib/viewers/media/DashViewer', () => { const [event, error] = dash.emit.getCall(0).args; expect(event).to.equal('error'); expect(error).to.be.instanceof(PreviewError); + expect(error.details.code).to.equal(shakaError.detail.code); + expect(error.details.severity).to.equal(shakaError.detail.severity); expect(error.code).to.equal('error_shaka'); });