build(docs-infra): log warning rather than error if content errors are not fatal (#24320)
PR Close #24320
This commit is contained in:

committed by
Victor Berchet

parent
68d37ef0c1
commit
700e55ce14
@ -34,6 +34,7 @@ module.exports = function checkContentRules(log, createDocMessage) {
|
||||
$runAfter: ['tags-extracted'],
|
||||
$runBefore: ['processing-docs'],
|
||||
$process(docs) {
|
||||
const logMessage = this.failOnContentErrors ? log.error.bind(log) : log.warn.bind(log);
|
||||
const errors = [];
|
||||
docs.forEach(doc => {
|
||||
const docErrors = [];
|
||||
@ -55,10 +56,10 @@ module.exports = function checkContentRules(log, createDocMessage) {
|
||||
});
|
||||
|
||||
if (errors.length) {
|
||||
log.error('Content contains errors');
|
||||
logMessage('Content contains errors');
|
||||
errors.forEach(docError => {
|
||||
const errors = docError.errors.join('\n ');
|
||||
log.error(createDocMessage(errors + '\n ', docError.doc));
|
||||
logMessage(createDocMessage(errors + '\n ', docError.doc));
|
||||
});
|
||||
if (this.failOnContentErrors) {
|
||||
throw new Error('Stopping due to content errors.');
|
||||
|
Reference in New Issue
Block a user