Skip to content

Commit

Permalink
fix: log an error if the generator does not supply an apiTemplates array
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinEberhardt committed Dec 14, 2022
1 parent 02e3767 commit 497d26a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ async function generate(schemaPathOrUrl, generatorPathOrUrl, options) {
if (file.endsWith("handlebars")) {
// run the handlebars template
const template = Handlebars.compile(source);
if (!generatorPackage.apiTemplates) {
throw new Error(
"The generator must supply a 'apiTemplates' array in package.json"
);
}
log.verbose("Populating template");
if (generatorPackage.apiTemplates.includes(file)) {
// Iterating tags to generate grouped paths
Expand Down
1 change: 1 addition & 0 deletions src/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function logFailedForge(exception) {
standard(`${divider}`);
if (isStandard() || isQuiet()) {
error(`${exception.message}`);
standard("increase logging verbosity for more information");
} else {
verbose(`${exception.stack}`);
}
Expand Down

0 comments on commit 497d26a

Please sign in to comment.