build(aio): improve error message for ignored example files (#19265)
Addresses https://github.com/angular/angular/pull/18707#issuecomment-330396771 PR Close #19265
This commit is contained in:

committed by
Igor Minar

parent
988b9f8378
commit
381e680758
@ -14,15 +14,22 @@ module.exports = function getExampleRegion(exampleMap, createDocMessage, collect
|
||||
|
||||
// If still no file then we error
|
||||
if (!exampleFile) {
|
||||
const message = createDocMessage('Missing example file... relativePath: "' + relativePath + '".', doc) + '\n' +
|
||||
'Example files can be found in: ' + EXAMPLES_FOLDERS.join(', ');
|
||||
throw new Error(message);
|
||||
const gitIgnoreFile = collectExamples.isExampleIgnored(relativePath);
|
||||
if( gitIgnoreFile) {
|
||||
const message = createDocMessage('Ignored example file... relativePath: "' + relativePath + '"', doc) + '\n' +
|
||||
'This example file exists but has been ignored by a rule, in "' + gitIgnoreFile + '".';
|
||||
throw new Error(message);
|
||||
} else {
|
||||
const message = createDocMessage('Missing example file... relativePath: "' + relativePath + '".', doc) + '\n' +
|
||||
'Example files can be found in the following relative paths: ' + EXAMPLES_FOLDERS.map(function(folder) { return '"' + folder + '"'; }).join(', ');
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
var sourceCodeDoc = exampleFile.regions[regionName || ''];
|
||||
if (!sourceCodeDoc) {
|
||||
const message = createDocMessage('Missing example region... relativePath: "' + relativePath + '", region: "' + regionName + '".', doc) + '\n' +
|
||||
'Regions available are:' + Object.keys[exampleFile.regions];
|
||||
'Regions available are: ' + Object.keys(exampleFile.regions).map(function(region) { return '"' + region + '"'; }).join(', ');
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user