UNPKG

@zendesk/zcli-themes

Version:

zcli theme commands live here

19 lines (18 loc) 971 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const validationErrorsToString_1 = require("./validationErrorsToString"); const chalk = require("chalk"); const errors_1 = require("@oclif/core/lib/errors"); function handleTemplateError(themePath, templateErrors) { const validationErrors = {}; for (const [template, errors] of Object.entries(templateErrors)) { // the theming endpoints return the template identifier as the 'key' instead of // the template path. We must fix this so we can reuse `validationErrorsToString` // and align with the job import error handling validationErrors[`templates/${template}.hbs`] = errors; } const title = `${chalk.bold('InvalidTemplates')} - Template(s) with syntax error(s)`; const details = (0, validationErrorsToString_1.default)(themePath, validationErrors); (0, errors_1.error)(`${title}\n${details}`); } exports.default = handleTemplateError;