Skip to content

Commit

Permalink
Add the html parser error to the error response for the v3 demo html …
Browse files Browse the repository at this point in the history
…endpoint
  • Loading branch information
JakeChampion committed Mar 16, 2021
1 parent 3c146ed commit 986bf66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/middleware/v3/outputDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const extractMinimalHtml = (fullHtml) => {
try {
formattedHTML = prettier.format(fullHtml, { parser: 'html' });
} catch (error) {
throw new ComponentError('The HTML in the demo contains syntax errors.');
throw new ComponentError('The HTML in the demo contains syntax errors. Error: ' + error.message.split('\n')[0]);
}
const $ = cheerio.load(formattedHTML);
const body = $('body');
Expand Down
2 changes: 1 addition & 1 deletion test/integration/v3-demos-html.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ describe('GET /v3/demo/html', function() {
});

it('should respond with an error message', function() {
assert.deepEqual(response.text, 'Origami Build Service returned an error: "The HTML in the demo contains syntax errors."');
assert.deepEqual(response.text, 'Origami Build Service returned an error: "The HTML in the demo contains syntax errors. Error: Unexpected character \\"/\\" (24:5)"');
});

});
Expand Down

0 comments on commit 986bf66

Please sign in to comment.