Skip to content

Commit

Permalink
Remove renderException (#2115)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish authored May 1, 2017
1 parent 8870c96 commit ae0e375
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
27 changes: 5 additions & 22 deletions lighthouse-core/report/v2/renderer/report-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,12 @@ class ReportRenderer {
*/
renderReport(report, container) {
container.textContent = ''; // Remove previous report.
const element = container.appendChild(this._renderReport(report));

let element;
try {
element = container.appendChild(this._renderReport(report));

// Hook in JS features and page-level event listeners after the report
// is in the document.
if (this._uiFeatures) {
this._uiFeatures.initFeatures(report);
}
} catch (/** @type {!Error} */ e) {
container.textContent = '';
element = container.appendChild(this._renderException(e));
// Hook in JS features and page-level event listeners after the report
// is in the document.
if (this._uiFeatures) {
this._uiFeatures.initFeatures(report);
}

return /** @type {!Element} **/ (element);
Expand All @@ -75,16 +68,6 @@ class ReportRenderer {
this._categoryRenderer.setTemplateContext(context);
}

/**
* @param {!Error} e
* @return {!Element}
*/
_renderException(e) {
const element = this._dom.createElement('div', 'lh-exception');
element.textContent = String(e.stack);
return element;
}

/**
* @param {!ReportRenderer.ReportJSON} report
* @return {!DocumentFragment}
Expand Down
10 changes: 0 additions & 10 deletions lighthouse-core/test/report/v2/renderer/report-renderer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@ describe('ReportRenderer V2', () => {
assert.ok(container.contains(newReport), 'new report appended to container');
});

it('should render an exception for invalid input', () => {
const container = renderer._dom._document.body;
const output = renderer.renderReport({
get reportCategories() {
throw new Error();
}
}, container);
assert.ok(output.classList.contains('lh-exception'));
});

it('renders a header', () => {
const header = renderer._renderReportHeader(sampleResults);
assert.ok(header.querySelector('.lh-export'), 'contains export button');
Expand Down

0 comments on commit ae0e375

Please sign in to comment.