diff --git a/core/frontend/apps/amp/lib/helpers/amp_content.js b/core/frontend/apps/amp/lib/helpers/amp_content.js index ba7f979fc6..b8b1fe71e4 100644 --- a/core/frontend/apps/amp/lib/helpers/amp_content.js +++ b/core/frontend/apps/amp/lib/helpers/amp_content.js @@ -133,14 +133,16 @@ function getAmperizeHTML(html, post) { if (err) { if (err.src) { + // This is a valid 500 GhostError because it means the amperize parser is unable to handle some Ghost HTML. logging.error(new errors.GhostError({ message: `AMP HTML couldn't get parsed: ${err.src}`, + code: 'AMP_PARSER_ERROR', err: err, context: post.url, help: i18n.t('errors.apps.appWillNotBeLoaded.help') })); } else { - logging.error(new errors.GhostError({err})); + logging.error(new errors.GhostError({err, code: 'AMP_PARSER_ERROR'})); } // save it in cache to prevent multiple calls to Amperize until diff --git a/core/frontend/services/settings/yaml-parser.js b/core/frontend/services/settings/yaml-parser.js index 59b32b1bdb..b032e56f4b 100644 --- a/core/frontend/services/settings/yaml-parser.js +++ b/core/frontend/services/settings/yaml-parser.js @@ -18,8 +18,10 @@ module.exports = function parseYaml(file, fileName) { } catch (error) { // CASE: parsing failed, `js-yaml` tells us exactly what and where in the // `reason` property as well as in the message. - throw new common.errors.GhostError({ + // As the file uploaded is invalid, the person uploading must fix this - it's a 4xx error + throw new common.errors.IncorrectUsageError({ message: common.i18n.t('errors.services.settings.yaml.error', {file: fileName, context: error.reason}), + code: 'YAML_PARSER_ERROR', context: error.message, err: error, help: common.i18n.t('errors.services.settings.yaml.help', {file: fileName})